public void index_should_return() { //act var sut = new AdminControllerBuilder().Build(); var view = sut.Index(); //assert Assert.NotNull(view); sut.AssertGetAttribute("Index"); }
public void new_translator_should_return_with_user_model() { //act var sut = new AdminControllerBuilder().Build(); var view = sut.NewTranslator(); var model = view.Model; //assert Assert.NotNull(view); Assert.NotNull(model); Assert.IsAssignableFrom(typeof(UserModel), model); sut.AssertGetAttribute("NewTranslator"); }
public async void users_should_return_with_paged_user_model_if_user_id_is_invalid() { //arrange var userService = new Mock <IUserService>(); userService.Setup(x => x.GetUsers(1)).Returns(() => Task.FromResult(new PagedList <User>(1, 1, 1, new List <User>()))); //act var sut = new AdminControllerBuilder().WithUserService(userService.Object) .Build(); var view = await sut.Users(0, 1) as ViewResult; // id = 0 => invalid UserId //assert Assert.NotNull(view); Assert.NotNull(view.Model); Assert.IsAssignableFrom(typeof(PageModel <UserModel>), view.Model); sut.AssertGetAttribute(ActionNameUsers, new[] { typeof(int), typeof(int) }); userService.Verify(x => x.GetUsers(1), Times.Once); }
public async void apps_should_return_with_list_app_model() { //arrange var appService = new Mock <IAppService>(); appService.Setup(x => x.GetApps(1)).Returns(Task.FromResult(new PagedList <App>(1, 1, 1, new List <App>()))); //act var sut = new AdminControllerBuilder().WithAppService(appService.Object) .Build(); var view = await sut.Apps(1) as ViewResult; //assert Assert.NotNull(view); Assert.NotNull(view.Model); Assert.IsAssignableFrom(typeof(PageModel <AppModel>), view.Model); sut.AssertGetAttribute(ActionNameApps, new[] { typeof(int) }); appService.Verify(x => x.GetApps(1), Times.Once); }