public async void apps_should_return_with_app_model() { //arrange var list = new List <App> { new App { Id = 1, Tokens = new List <Token>() }, new App { Id = 2, Tokens = new List <Token>() } }; var appService = new Mock <IAppService>(); appService.Setup(x => x.GetByUserId(1, 1)) .Returns(Task.FromResult(new PagedList <App>(1, 2, 3, list))); //act var sut = new UserControllerBuilder().WithAppService(appService.Object) .Build(); var view = await sut.Apps(1, 1) as ViewResult; var model = view.Model as PageModel <AppModel>; //assert Assert.NotNull(view); Assert.NotNull(model); Assert.IsInstanceOf <BaseController>(sut); Assert.IsAssignableFrom <PageModel <AppModel> >(view.Model); Assert.AreEqual(model.Items.Count, list.Count); CollectionAssert.AllItemsAreUnique(model.Items); appService.Verify(x => x.GetByUserId(1, 1), Times.Once); sut.AssertGetAttribute(ActionNameApps, new[] { typeof(int), typeof(int) }); }