예제 #1
0
        public void Volunteers_TwoTeachersHaveOneHourSessions_EachTeachersHoursSummedCorrectly()
        {
            var sessions = new List <Session>()
            {
                new Session()
                {
                    InTime  = new DateTime(2020, 12, 05, 10, 0, 0),
                    OutTime = new DateTime(2020, 12, 05, 11, 00, 0),
                    Person  = new Person()
                    {
                        FirstName  = "Teacher",
                        LastName   = "Teach",
                        Email      = "*****@*****.**",
                        PersonType = PersonType.Teacher
                    }
                },
                new Session()
                {
                    InTime  = new DateTime(2020, 12, 07, 10, 0, 0),
                    OutTime = new DateTime(2020, 12, 07, 11, 00, 0),
                    Person  = new Person()
                    {
                        FirstName  = "Teacher",
                        LastName   = "Teach",
                        Email      = "*****@*****.**",
                        PersonType = PersonType.Teacher
                    }
                },
            };

            var results = ReportsBusinessLogic.Volunteers(sessions, new DateTime(2020, 12, 01), new DateTime(2020, 12, 07));

            Assert.Equal(1, results.Where(x => x.TeacherEmail == "*****@*****.**").FirstOrDefault().TotalHours);
            Assert.Equal(1, results.Where(x => x.TeacherEmail == "*****@*****.**").FirstOrDefault().TotalHours);
        }
예제 #2
0
        public void Volunteers_SessionOnEndDay_ResultListShouldHaveOneElement()
        {
            var sessions = new List <Session>()
            {
                new Session()
                {
                    InTime  = new DateTime(2020, 12, 07, 10, 0, 0),
                    OutTime = new DateTime(2020, 12, 07, 11, 00, 0),
                    Person  = new Person()
                    {
                        FirstName  = "Teacher",
                        LastName   = "Teach",
                        Email      = "*****@*****.**",
                        PersonType = PersonType.Teacher
                    }
                }
            };

            var results = ReportsBusinessLogic.Volunteers(sessions, new DateTime(2020, 12, 01), new DateTime(2020, 12, 07));

            Assert.Single(results);
        }
예제 #3
0
 public IActionResult Volunteers([FromQuery] DateTime start, [FromQuery] DateTime end)
 {
     return(Ok(ReportsBusinessLogic.Volunteers(_sessionRepo.GetAll(), start, end)));
 }