public void the_reportwriter_does_not_double_count() { var sessionId = "THESESSION"; var reallyEarly = DateTime.Today.AddHours(1); var theEvent = new SiteVisted(sessionId, reallyEarly); var atNoon = reallyEarly.AddHours(11); // An IOC container will locate all handlers, but we know that they'll all // get located so lets manually execute them var event1 = new SiteVisted(sessionId, reallyEarly); _reporter.Handle(event1); _visitRecorder.Handle(event1); var event2 = new SiteVisted(sessionId, atNoon); _reporter.Handle(event2); _visitRecorder.Handle(event2); var visitorsToday = _visitorsByDateRepository.GetReportFor(DateTime.Today).UniqueVisitors; Assert.AreEqual(1, visitorsToday); }
public void the_reportwriter_records_unique_visitor_for_his_first_visit() { var sessionId = "THESESSION"; var reallyEarly = DateTime.Today.AddHours(1); var theEvent = new SiteVisted(sessionId, reallyEarly); _reporter.Handle(theEvent); var visitorsToday = _visitorsByDateRepository.GetReportFor(DateTime.Today).UniqueVisitors; Assert.AreEqual(1,visitorsToday); }
public IQueryable<SiteVisit> GetWithoutIncluding(SiteVisted @event) { return _siteVisits.Where(sv => sv.SessionId != @event.SessionId || sv.When != @event.When).AsQueryable(); }