public void GetPastEvents_Only_Returns_Previous_Events() { //Arrange var cacheService = new StubICacheService(); var eventsRepo = new StubIRepository<Event>() { FindExpressionOfFuncOfT0Boolean = (func) => EventTestData.MultipleEvents.AsQueryable().Where(func) }; var eventService = new EventsService(eventsRepo, cacheService); //act using (ShimsContext.Create()) { //Set current DateTime.Now to 12/12/12 ShimDateTime.NowGet = () => new DateTime(2012, 12, 12); var results = eventService.GetPastEvents(); //assert Assert.AreEqual(2, results.Count()); } }