Exemple #1
0
        public void ClassTours_SchoolVisitsTwoTimesWithinDates_OtherSchoolVisitsOnce_FirstSchoolNumberOfStudentsShouldBeSummed_SecondSchoolStudentCountShouldBeEqualToNumberOfStudentsForThatTour()
        {
            var tours = new List <ClassTour>()
            {
                new ClassTour()
                {
                    DayVisited       = new DateTime(2020, 12, 01),
                    Name             = "Point Pleasant High School",
                    NumberOfStudents = 25
                },
                new ClassTour()
                {
                    DayVisited       = new DateTime(2020, 12, 07),
                    Name             = "Point Pleasant High School",
                    NumberOfStudents = 25
                },
                new ClassTour()
                {
                    DayVisited       = new DateTime(2020, 12, 06),
                    Name             = "Parkersburg High School",
                    NumberOfStudents = 11
                },
            };

            var results = ReportsBusinessLogic.ClassTours(tours, new DateTime(2020, 12, 01), new DateTime(2020, 12, 07));

            Assert.Equal(2, results.Count());
            Assert.Equal(50, results.Where(x => x.Name == "Point Pleasant High School").FirstOrDefault().Students);
            Assert.Equal(11, results.Where(x => x.Name == "Parkersburg High School").FirstOrDefault().Students);
        }
Exemple #2
0
        public void ClassTours_TourOnEndDay_ResultListShouldHaveOneElement()
        {
            var tours = new List <ClassTour>()
            {
                new ClassTour()
                {
                    DayVisited       = new DateTime(2020, 12, 07),
                    Name             = "Point Pleasant High School",
                    NumberOfStudents = 23
                }
            };

            var results = ReportsBusinessLogic.ClassTours(tours, new DateTime(2020, 12, 01), new DateTime(2020, 12, 07));

            Assert.Single(results);
        }
Exemple #3
0
        public void ClassTours_SchoolVisitsTwoTimesWithinDates_ResultListShouldHaveOneElement_StudentsShouldBeSumOfNumberOfStudentsSForBothVisits()
        {
            var tours = new List <ClassTour>()
            {
                new ClassTour()
                {
                    DayVisited       = new DateTime(2020, 12, 01),
                    Name             = "Point Pleasant High School",
                    NumberOfStudents = 25
                },
                new ClassTour()
                {
                    DayVisited       = new DateTime(2020, 12, 07),
                    Name             = "Point Pleasant High School",
                    NumberOfStudents = 25
                }
            };

            var results = ReportsBusinessLogic.ClassTours(tours, new DateTime(2020, 12, 01), new DateTime(2020, 12, 07));

            Assert.Single(results);
            Assert.Equal(50, results.Where(x => x.Name == "Point Pleasant High School").FirstOrDefault().Students);
        }
Exemple #4
0
 public IActionResult ClassTours([FromQuery] DateTime start, [FromQuery] DateTime end)
 {
     return(Ok(ReportsBusinessLogic.ClassTours(_classTourRepo.GetAll(), start, end)));
 }