public void Private_Booking_Should_Only_Show_PrivateBooking() { IGigRepository repo = Substitute.For<IGigRepository>(); repo.List() .Returns(new List<Gig> { new Gig {Date = DateTime.Today.AddDays(1), Name = "PrivateBooking", Private = true}, }); GigController controller = new GigController(repo); ViewResult result = (ViewResult)controller.Index(); IEnumerable<GigViewModel> models = (IEnumerable<GigViewModel>) result.Model; Assert.AreEqual("Private Booking",models.First().Name); }
public void Should_Only_Show_Future_Gigs() { IGigRepository repo = Substitute.For<IGigRepository>(); repo.List() .Returns(new List<Gig>() { new Gig() {Date = DateTime.Today.AddDays(-1), Name = "Yesterday"}, new Gig() {Date = DateTime.Today.AddDays(1), Name = "Tomorrow"} }); GigController controller = new GigController(repo); ViewResult result = (ViewResult)controller.Index(); IEnumerable<GigViewModel> model = (IEnumerable<GigViewModel>)result.Model; Assert.AreEqual(1, model.Count()); }