public void SendAllWarnings() { _sendWarning.MakeReports += SendToEMailStu.SendWarning; _sendWarning.SendWarningToStudents(_getDataForWarning.AverageMarkLimit(4)); _sendWarning.MakeReports -= SendToEMailStu.SendWarning; _sendWarning.MakeReports += SendToSMS.SendWarning; _sendWarning.SendWarningToStudents(_getDataForWarning.GetStudentsPasses(3)); _sendWarning.MakeReports -= SendToSMS.SendWarning; }
public void GetStudentsPassesTest() { // Arrange var mockIEducationRepository = new Mock <IEducationRepository>(); var mockIStudentRepository = new Mock <IStudentRepository>(); mockIEducationRepository.Setup(er => er.GetStudentRepository()).Returns(mockIStudentRepository.Object); var mockILoggerStudentsService = new Mock <ILogger <GetDataForWarning> >(); AttendingLecture al1 = new AttendingLecture() { Atended = false }; AttendingLecture al12 = new AttendingLecture() { Atended = false }; AttendingLecture al13 = new AttendingLecture() { Atended = false }; AttendingLecture al2 = new AttendingLecture() { Atended = true, }; AttendingLecture al3 = new AttendingLecture() { Atended = true, }; Student st1 = new Student() { FullName = "s1", AttendingLectures = new HashSet <AttendingLecture>() { al1, al12, al13 } }; Student st2 = new Student() { FullName = "s2", AttendingLectures = new HashSet <AttendingLecture>() { al2 } }; Student st3 = new Student() { FullName = "s3", AttendingLectures = new HashSet <AttendingLecture>() { al3 } }; Student st4 = new Student() { FullName = "s4" }; mockIStudentRepository.Setup(sr => sr.GetStudentsIncludeAttendingLecturesAndHomeWork()).Returns(new List <Student>() { st1, st2, st3, st4, }); Mapper mapper = new Mapper(new MapperConfiguration(cfg => cfg.CreateMap <Student, StudentBL>())); GetDataForWarning getDataForWarning = new GetDataForWarning(mockIEducationRepository.Object, mockILoggerStudentsService.Object, mapper); List <string> expected = new List <string>() { "s1" }; //act List <string> actual = getDataForWarning.GetStudentsPasses(3).ToList().ConvertAll(s => s.FullName); //assert Assert.Equal(expected, actual); }