0
MVP 응용 프로그램에서 발표자 단위 테스트를 시도하고 있습니다. NSsite를 사용하여 조롱하려고하는 내보기 인터페이스는 다음과 같습니다.NSubstitute를 사용하여 MVP에서 뷰 속성을 조롱 할 수없는 이유
public interface ICategoriesView : IBaseViewInterface
{
string CategoryName { get; }
long CategorId { get; }
long CategoryParent { get; }
IEnumerable<EntityObject> CategoryDataSource { set; }
}
여기 내 단위 테스트 클래스입니다. 나는 NUnit 프레임 워크를 사용하고있다 :
[TestFixture]
public class CategoriesTests
{
[Test(Description="this is used for testing the behavior of presenter if we pass empty name.")]
public void Add_EmptyName_Fails()
{
var _view = NSubstitute.Substitute.For<ICategoriesView>();
//now here i'm supposed to get something like _view.CategoryId.Returns(2) but i don't!
//the error message says that _view.CategoryId doesn't have an extension method
//named Returns. and it's true since intellisence doesn't list it after period
}
}
나는보기 인터페이스에 modifier를 추가했는데 작동하지 않았다. 그래서 뭐가 잘못 됐니?
'ICategoriesView' :'CategoryId'가 아닌'CategorId'에 오타가 있습니까? –