Exemple #1
0
        public void SuccessReport_OneClass_StudentReceivedFIW_ClassPassedSuccessfullyIsZero_ClassCompletedSuccessfullyIsZero_DroppedStudentCountIsOne_UniqueCountIsOne()
        {
            var classWithGradeList = new List <ClassWithGradeDTO>()
            {
                new ClassWithGradeDTO()
                {
                    CourseName     = "History",
                    CRN            = 111,
                    DepartmentName = "History Dept",
                    FinalGrade     = Grade.FIW
                }
            };

            var results = ReportsBusinessLogic.SuccessReport(classWithGradeList);

            Assert.Equal(0, results.Where(x => x.CRN == 111).FirstOrDefault().CompletedCourseCount);
            Assert.Equal(0, results.Where(x => x.CRN == 111).FirstOrDefault().PassedSuccessfullyCount);
            Assert.Equal(1, results.Where(x => x.CRN == 111).FirstOrDefault().DroppedStudentCount);
            Assert.Equal(1, results.Where(x => x.CRN == 111).FirstOrDefault().UniqueStudentCount);
        }
Exemple #2
0
        public void Reasons_SessionWithClassSelectedAndStudyTimeSelected_TutoringIsTrue_VisitsForTutoringShouldBeOne_VisitsForStudyTimeShouldBeOne()
        {
            var sessions = new List <Session>()
            {
                new Session()
                {
                    InTime   = new DateTime(2020, 12, 30, 10, 0, 0),
                    OutTime  = new DateTime(2020, 12, 30, 11, 00, 0),
                    Tutoring = true,
                    Person   = new Person()
                    {
                        PersonType = PersonType.Student, Email = "*****@*****.**", FirstName = "Student", LastName = "One", Id = 12345
                    },
                    SessionClasses = new List <SessionClass>()
                    {
                        new SessionClass()
                        {
                            Class = new Class()
                            {
                                Name = "Art 101", CRN = 123, ShortName = "Art", DepartmentCode = 111
                            }
                        }
                    },
                    SessionReasons = new List <SessionReason>()
                    {
                        new SessionReason()
                        {
                            Reason = new Reason()
                            {
                                Name = "Study Time", Deleted = false
                            }
                        }
                    }
                }
            };

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

            Assert.Equal(1, results.Where(x => x.ReasonName == "Tutoring").FirstOrDefault().Visits);
            Assert.Equal(1, results.Where(x => x.ReasonName == "Study Time").FirstOrDefault().Visits);
        }
Exemple #3
0
        public void Reasons_SessionOnEndDay_ResultCountShouldBeOne()
        {
            var sessions = new List <Session>()
            {
                new Session()
                {
                    InTime   = new DateTime(2020, 12, 30, 10, 0, 0),
                    OutTime  = new DateTime(2020, 12, 30, 11, 00, 0),
                    Tutoring = false,
                    Person   = new Person()
                    {
                        PersonType = PersonType.Student, Email = "*****@*****.**", FirstName = "Student", LastName = "One", Id = 12345
                    },
                    SessionClasses = new List <SessionClass>()
                    {
                        new SessionClass()
                        {
                            Class = new Class()
                            {
                                Name = "Art 101", CRN = 123, ShortName = "Art", DepartmentCode = 111
                            }
                        }
                    },
                    SessionReasons = new List <SessionReason>()
                    {
                        new SessionReason()
                        {
                            Reason = new Reason()
                            {
                                Name = "Study Time", Deleted = false
                            }
                        }
                    }
                }
            };

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

            Assert.Single(results);
        }
Exemple #4
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 #5
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);
        }
Exemple #6
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 #7
0
        public void Reasons_TwoSessionsForAClass_TutoringIsTrue_TwoDifferentReasonsForVisit_ResultsIncludesClassFourTimes_OnceForEachReason()
        {
            var sessions = new List <Session>()
            {
                new Session()
                {
                    InTime   = new DateTime(2020, 12, 24, 10, 0, 0),
                    OutTime  = new DateTime(2020, 12, 24, 11, 00, 0),
                    Tutoring = true,
                    Person   = new Person()
                    {
                        PersonType = PersonType.Student, Email = "*****@*****.**", FirstName = "Student", LastName = "One", Id = 12345
                    },
                    SessionClasses = new List <SessionClass>()
                    {
                        new SessionClass()
                        {
                            Class = new Class()
                            {
                                Name = "Art 101", CRN = 123, ShortName = "Art", DepartmentCode = 111
                            }
                        }
                    },
                    SessionReasons = new List <SessionReason>()
                    {
                        new SessionReason()
                        {
                            Reason = new Reason()
                            {
                                Name = "Study Time", Deleted = false
                            }
                        }
                    }
                },
                new Session()
                {
                    InTime   = new DateTime(2020, 12, 24, 10, 0, 0),
                    OutTime  = new DateTime(2020, 12, 24, 11, 00, 0),
                    Tutoring = true,
                    Person   = new Person()
                    {
                        PersonType = PersonType.Student, Email = "*****@*****.**", FirstName = "Student", LastName = "One", Id = 12345
                    },
                    SessionClasses = new List <SessionClass>()
                    {
                        new SessionClass()
                        {
                            Class = new Class()
                            {
                                Name = "Art 101", CRN = 123, ShortName = "Art", DepartmentCode = 111
                            }
                        }
                    },
                    SessionReasons = new List <SessionReason>()
                    {
                        new SessionReason()
                        {
                            Reason = new Reason()
                            {
                                Name = "Printer Use", Deleted = false
                            }
                        }
                    }
                },
            };

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

            Assert.Equal(3, results.Where(x => x.ClassName == "Art 101").Count());
            Assert.Equal(2, results.Where(x => x.ReasonName == "Tutoring").FirstOrDefault().Visits);
        }
Exemple #8
0
 public IActionResult Reasons([FromQuery] DateTime start, [FromQuery] DateTime end)
 {
     return(Ok(ReportsBusinessLogic.Reasons(_sessionRepo.GetAll(), start, end)));
 }
Exemple #9
0
 public IActionResult ClassTours([FromQuery] DateTime start, [FromQuery] DateTime end)
 {
     return(Ok(ReportsBusinessLogic.ClassTours(_classTourRepo.GetAll(), start, end)));
 }
Exemple #10
0
 public IActionResult Get([FromQuery] DateTime start, [FromQuery] DateTime end)
 {
     return(Ok(ReportsBusinessLogic.WeeklyVisits(_sessionRepo.GetAll(), start, end)));
 }
Exemple #11
0
 public void SetUp()
 {
     _reportsBusinessLogic = new ReportsBusinessLogic(_reportsAdapter.Object);
 }