示例#1
0
        public void Index_PopulatesViewBagSearchModelCorrectly()
        {
            // Arrange
            var expectedSearchModel = new[] {
                new JobCategoryCountDto()
            }.ToList();

            _jobOpportunityRepository.GetMainJobCategoriesCount()
            .Returns(expectedSearchModel);

            // Act
            var result = (ViewResult)_sut.Index();

            // Assert
            _jobOpportunityRepository.Received(1).GetMainJobCategoriesCount();

            var searchModel = (JobOpportunitySearchViewModel)result.ViewBag.SearchViewModel;

            searchModel.CategoriesCount.Should().BeSameAs(expectedSearchModel);
        }