示例#1
0
        public void Index()
        {
            // Arrange
            HostsController controller = new HostsController();

            // Act
            ViewResult result = controller.Index(null) as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
示例#2
0
        public void CanListHosts()
        {
            // Establish Context
            var viewModelToExpect = new SearchResultFormViewModel <HostDto, HostSearchRequest>();

            viewModelToExpect.PageResultItems = new List <HostDto>();

            var hostDto = new HostDto();

            viewModelToExpect.PageResultItems.Add(hostDto);

            hostSearchManagementService.Expect(r => r.CreateFormViewModel())
            .Return(viewModelToExpect);

            // Act
            ViewResult result = hostsController.Index().AssertViewRendered();

            // Assert
            result.ViewData.Model.ShouldNotBeNull();
            (result.ViewData.Model as SearchResultFormViewModel <HostDto, HostSearchRequest>).ShouldNotBeNull();
            (result.ViewData.Model as SearchResultFormViewModel <HostDto, HostSearchRequest>).PageResultItems.Count.
            ShouldBeGreaterThan(0);
        }