Esempio n. 1
0
        public void Index_ReturnsModelCorrectly()
        {
            // Arrange
            List <JobOpportunity> expectedModel = new[] {
                new JobOpportunity {
                    Id = 123
                }
            }.ToList();

            _jobOpportunityRepository.GetLatestJobOpportunity(7)
            .Returns(expectedModel);

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

            // Assert
            _jobOpportunityRepository.Received(1).GetLatestJobOpportunity(7);

            var viewModel = (List <JobOpportunity>)result.Model;

            viewModel.Should().BeSameAs(expectedModel);
        }