예제 #1
0
        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);
        }