Exemple #1
0
        public void WeeklyVisits_SessionOnTheDayAfterEndDate_ResultCountShouldBeZero()
        {
            var sessions = new List <Session>()
            {
                new Session()
                {
                    InTime  = new DateTime(2020, 12, 31, 10, 0, 0),
                    OutTime = new DateTime(2020, 12, 31, 11, 00, 0),
                }
            };

            var results = ReportsBusinessLogic.WeeklyVisits(sessions, new DateTime(2020, 12, 24), new DateTime(2020, 12, 30));

            Assert.Equal(0, results.FirstOrDefault().Count);
        }
Exemple #2
0
        public void WeeklyVisits_TwoWeekSpan_OneSessionEachWeek_ResultsShouldHaveCountOfTwo_EachWeekShouldHaveCountOfOne()
        {
            var sessions = new List <Session>()
            {
                new Session()
                {
                    InTime  = new DateTime(2020, 12, 01, 10, 0, 0),
                    OutTime = new DateTime(2020, 12, 01, 11, 00, 0),
                },
                new Session()
                {
                    InTime  = new DateTime(2020, 12, 10, 10, 0, 0),
                    OutTime = new DateTime(2020, 12, 10, 11, 00, 0),
                },
            };

            var results = ReportsBusinessLogic.WeeklyVisits(sessions, new DateTime(2020, 12, 1), new DateTime(2020, 12, 14));

            Assert.Equal(2, results.Count());
            Assert.Equal(1, results[0].Count);
            Assert.Equal(1, results[1].Count);
        }
Exemple #3
0
 public IActionResult Get([FromQuery] DateTime start, [FromQuery] DateTime end)
 {
     return(Ok(ReportsBusinessLogic.WeeklyVisits(_sessionRepo.GetAll(), start, end)));
 }