예제 #1
0
        public HomeIndexViewModel IndexQuery()
        {
            var viewmodel = new HomeIndexViewModel();

            //var user = userQueryService.GetUser(1);
            var user = userQueryService.GetUserFromRepo(1);

            viewmodel.Name = user.Name;
            viewmodel.UserId = user.UserId;

            return viewmodel;
        }
예제 #2
0
        public void Index_HttpPost_ValidViewModelReturned()
        {
            //ARRANGE
            this.InitializeConstructorParameters();

            var viewModel = new HomeIndexViewModel();

            viewModel.UserId = 1;
            viewModel.Name = "Kermit";

            homeControllerAssemblerMock.Setup(assembler => assembler.IndexQuery()).Returns(viewModel);

            //ACT
            var controller = new HomeController(homeControllerAssemblerMock.Object);
            var viewResult = controller.Index() as ViewResult;

            //ASSERT
            Assert.NotNull(viewResult.ViewData.Model);
        }