public void ShouldDisplayReleases() { IEnumerable<ReleaseDetailsModel> expectedReleaseModel = new List<ReleaseDetailsModel> { new ReleaseDetailsModel("Enzo", "REL1216", new DateTime(2011,10,20)), new ReleaseDetailsModel("Enzo", "REL54164", new DateTime(2011,11,20)), new ReleaseDetailsModel("Enzo", "REL123", new DateTime(2011,03,20)), new ReleaseDetailsModel("Enzo", "REL124", new DateTime(2011,02,27)), new ReleaseDetailsModel("Enzo", "REL125", new DateTime(2011,09,26)), new ReleaseDetailsModel("Colombo", "REL1000", new DateTime(2011,12,25)), new ReleaseDetailsModel("Colombo", "REL11122", new DateTime(2011,11,04)) }; var releaseRepository = new Mock<IReleaseRepository>(); releaseRepository.Setup(x => x.GetReleases()).Returns(expectedReleaseModel); var releaseController = new ReleaseController(releaseRepository.Object); ViewResult result = releaseController.Index(); var model = (IEnumerable<ReleaseDetailsModel>)result.ViewData.Model; Assert.That(result.ViewName, Is.EqualTo("Release")); Assert.That(model, Is.EqualTo(expectedReleaseModel)); Assert.That(model.First().TeamName, Is.EqualTo("Enzo")); }
public void ShouldDisplayAllReleases() { // TODO: tests about different types of data should happen in the repository // like different teams and different dates IEnumerable<Release> expectedReleaseModel = new List<Release> { new Release("Enzo", "REL1216", new DateTime(2011, 10, 20)), }; var releaseRepository = new Mock<IReleaseRepository>(); releaseRepository.Setup(x => x.GetReleases()).Returns(expectedReleaseModel); var releaseController = new ReleaseController(releaseRepository.Object); ViewResult result = releaseController.Index(); var model = (IEnumerable<Release>) result.ViewData.Model; Assert.That(result.ViewName, Is.EqualTo("Release")); Assert.That(model, Is.EqualTo(expectedReleaseModel)); }