public void CheckEventsDbTest() { PrepareTestEvent(); var TestListEvents = new List <object[]>(); TestListEvents = PrepareTestListEvents(1); MsDb msDb = new MsDb("name=StaffContextTests"); msDb.CheckEventsDb(TestListEvents); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String EventName = msDbRequester.getEventNameByPupilIdOld(5000); Assert.IsTrue(EventName == "Первый проход"); TestListEvents = PrepareTestListEvents(2); msDb.CheckEventsDb(TestListEvents); EventName = msDbRequester.getEventNameByPupilIdOld(5000); Assert.IsTrue(EventName == "Первый проход"); TestListEvents = PrepareTestListEvents(3); msDb.CheckEventsDb(TestListEvents); EventName = msDbRequester.getEventNameByPupilIdOld(5000); Assert.IsTrue(EventName == "Вышел"); TestListEvents = PrepareTestListEvents(); msDb.CheckEventsDb(TestListEvents); EventName = msDbRequester.getEventNameByPupilIdOld(5000); Assert.IsTrue(EventName == "Вернулся"); }
public void SendNotifyFirstPassTest() { PrepareTestPupil(); PrepareTestEvent(); PrepareTestSchedule(); var TestObject1 = PrepareTestObject5MinPast(); var TestObject2 = PrepareTestObject5MinFuture(); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests"); EljurApiSender EljurApiSender = new EljurApiSender("name=StaffContextTests"); var result = EljurApiSender.SendNotifyFirstPass(TestObject1); Assert.IsTrue(result); String EventName = msDbRequester.getEventNameByPupilIdOld(5000); Assert.IsTrue(EventName == "Первый проход"); result = EljurApiSender.SendNotifyFirstPass(TestObject2); Assert.IsTrue(result); EventName = msDbRequester.getEventNameByPupilIdOld(5000); msDbSetter.SetDelAllEventsForTesting(); Assert.IsTrue(EventName == "Опоздал"); }
public void CheckTimeTest() { TimeSpan now = DateTime.Now.TimeOfDay; TimeSpan nowPlusMinute = now.Add(new TimeSpan(0, 1, 0)); TimeSpan nowMinusMinute = now.Add(new TimeSpan(0, -1, 0)); TimeChecker timeCheckerWithParam = new TimeChecker(nowMinusMinute, nowPlusMinute); timeCheckerWithParam.CheckTime(new Action(delegate { MsDbCleaner msDbCleaner = new MsDbCleaner("name=StaffContextTests"); MsDbUpdater msDbUpdater = new MsDbUpdater("name=StaffContextTests"); msDbCleaner.clearAllTablesBesidesPupils(); var AllStaff = new List <object[]>(); AllStaff = getStaffListTest(); var AllClasses = getClassesListTest(); msDbUpdater.UpdateMsDb(AllStaff, AllClasses); })); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String FullFIO1 = msDbRequester.getFullFIOByPupilIdOld(5000); String FullFIO2 = msDbRequester.getFullFIOByPupilIdOld(5001); String FullFIO3 = msDbRequester.getFullFIOByPupilIdOld(5002); Assert.IsTrue(FullFIO1 == "Обновляев Обновляй Обновляевич"); Assert.IsTrue(FullFIO2 == "Петров Петр Петрович"); Assert.IsTrue(FullFIO3 == "Сидоров Сидор Сидорович"); }
public void SetOneFullEventForTestingTest() { PrepareTestEvent(); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String EventName = msDbRequester.getEventNameByPupilIdOld(5000); Assert.IsTrue(EventName == "Ушёл слишком рано"); }
public void getEventdByPupilIdOldTest() { PrepareTestEvent(); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); Event retEvent = msDbRequester.getEventdByPupilIdOld(5000); Assert.IsTrue(retEvent.EventName == "Ушёл слишком рано"); }
public void getPupilIdOldByFullFioTest() { PrepareTestPupil(); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); int PupilIdOld = msDbRequester.getPupilIdOldByFullFio("Тестов Тест Тестович"); TestContext.WriteLine(PupilIdOld.ToString()); Assert.IsTrue(PupilIdOld == 5005); }
public void getClasByPupilIdOldTest() { PrepareTestPupil(); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String Clas = msDbRequester.getClasByPupilIdOld(5005); TestContext.WriteLine(Clas); Assert.IsTrue(Clas == "1Б"); }
public void getStartTimeLessonsByClasTest() { PrepareTestSchedule(); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); TimeSpan StartTimeLessons = msDbRequester.getStartTimeLessonsByClas("1Б"); TestContext.WriteLine(StartTimeLessons.ToString()); Assert.IsTrue(StartTimeLessons == TimeSpan.Parse("00:00:10")); }
public void getEljurAccountIdByPupilIdOldTest() { PrepareTestPupil(); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); int EljurAccountId = msDbRequester.getEljurAccountIdByPupilIdOld(5005); TestContext.WriteLine(EljurAccountId.ToString()); Assert.IsTrue(EljurAccountId == 666); }
public void getFullFIOByPupilIdOldTest() { PrepareTestPupil(); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String FullFIO = msDbRequester.getFullFIOByPupilIdOld(5005); TestContext.WriteLine(FullFIO); Assert.IsTrue(FullFIO == "Тестов Тест Тестович"); }
public void getNotifyEnableByPupilIdOldTest() { PrepareTestPupil(); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); Boolean NotifyEnable = msDbRequester.getNotifyEnableByPupilIdOld(5103); TestContext.WriteLine(NotifyEnable.ToString()); Assert.IsTrue(NotifyEnable == false); }
public void AddNewPupilTest() { NewStaffAdder newStaffAdder = new NewStaffAdder("name=StaffContextTests"); var AllStaff = getStaffListTest(); newStaffAdder.AddNewPupil(AllStaff); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String FullFIO = msDbRequester.getFullFIOByPupilIdOld(5004); Assert.IsTrue(FullFIO == "Новиков Новый Новович"); }
public void SetStatusCameTooLateTest() { PrepareTestEvent(); MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests");; msDbSetter.SetStatusCameTooLate(5000); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String EventName = msDbRequester.getEventNameByPupilIdOld(5000); msDbSetter.SetDelAllEventsForTesting(); Assert.IsTrue(EventName == "Опоздал"); }
public void SetStatusNotifyWasSendTest() { PrepareTestEvent(); MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests");; msDbSetter.SetStatusNotifyWasSend(5000); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); Boolean NotifyWasSend = msDbRequester.getStatusNotifyWasSendByPupilIdOld(5000); msDbSetter.SetDelAllEventsForTesting(); Assert.IsTrue(NotifyWasSend == true); }
public void RegisterInputEventTest() { PrepareTestEvent(); var TestListEvents = new List <object[]>(); TestListEvents = PrepareTestListEvents(1); MsDb msDb = new MsDb("name=StaffContextTests"); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); var curEvent = msDbRequester.getEventdByPupilIdOld(5000); msDb.RegisterInputEvent(curEvent, TestListEvents.First(), 5000); String EventName = msDbRequester.getEventNameByPupilIdOld(5000); Assert.IsTrue(EventName == "Вернулся"); }
public void UpdateStaffTest() { PrepareTest(); MsDbStaffUpdater msDbStaffUpdater = new MsDbStaffUpdater("name=StaffContextTests"); var AllStaff = getStaffListTestUpdated(); msDbStaffUpdater.UpdateStaff(AllStaff); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String FullFIO1 = msDbRequester.getFullFIOByPupilIdOld(5000); String FullFIO2 = msDbRequester.getFullFIOByPupilIdOld(5001); String FullFIO3 = msDbRequester.getFullFIOByPupilIdOld(5002); Assert.IsTrue(FullFIO1 == "Иванова Ивана Ивановна"); Assert.IsTrue(FullFIO2 == "Петрова Петра Петровна"); Assert.IsTrue(FullFIO3 == "Сидорова Сидора Сидоровна"); }
public void FillOnlyPupilsTest() { PrepareTest(); MsDbFiller msDbFiller = new MsDbFiller("name=StaffContextTests"); var AllStaff = getStaffListTest(); msDbFiller.FillOnlyPupils(AllStaff); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String FullFIO1 = msDbRequester.getFullFIOByPupilIdOld(5000); String FullFIO2 = msDbRequester.getFullFIOByPupilIdOld(5001); String FullFIO3 = msDbRequester.getFullFIOByPupilIdOld(5002); Assert.IsTrue(FullFIO1 == "Иванов Иван Иванович"); Assert.IsTrue(FullFIO2 == "Петров Петр Петрович"); Assert.IsTrue(FullFIO3 == "Сидоров Сидор Сидорович"); }
public void MainUpdateStaffTest() { MainStaffUpdater mainStaffUpdater = new MainStaffUpdater("name=StaffContextTests"); var AllStaff = getStaffListTest(); mainStaffUpdater.MainUpdateStaff(AllStaff); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String FullFIO1 = msDbRequester.getFullFIOByPupilIdOld(5000); String FullFIO2 = msDbRequester.getFullFIOByPupilIdOld(5001); String FullFIO3 = msDbRequester.getFullFIOByPupilIdOld(5002); Assert.IsTrue(FullFIO1 == "Иванов Иван Иванович"); Assert.IsTrue(FullFIO2 == "Петров Петр Петрович"); Assert.IsTrue(FullFIO3 == "Сидоров Сидор Сидорович"); }
public void SetClasByPupilIdOldTest() { PrepareTestPupil(); MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests"); int PupilIdOld = 5005; String Clas = "1А"; msDbSetter.SetClasByPupilIdOld(PupilIdOld, Clas); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String ReqClas = msDbRequester.getClasByPupilIdOld(5005); msDbSetter.SetDelAllPupilsForTesting(); Assert.IsTrue(Clas == ReqClas); }
public void UpdateStaffDbTest() { MsDbUpdater msDbUpdater = new MsDbUpdater("name=StaffContextTests"); var AllStaff = getStaffListTest(); msDbUpdater.UpdateStaffDb(AllStaff); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String FullFIO1 = msDbRequester.getFullFIOByPupilIdOld(5000); String FullFIO2 = msDbRequester.getFullFIOByPupilIdOld(5001); String FullFIO3 = msDbRequester.getFullFIOByPupilIdOld(5002); Assert.IsTrue(FullFIO1 == "Иванов Иван Иванович"); Assert.IsTrue(FullFIO2 == "Петров Петр Петрович"); Assert.IsTrue(FullFIO3 == "Сидоров Сидор Сидорович"); EmptyChecker emptyChecker = new EmptyChecker("StaffContextTests"); Assert.IsTrue(false == emptyChecker.IsTableEmpty("Schedules")); }
public void SetUpdatedEventTest() { PrepareTestEvent(); Event UpdatedEvent = new Event(); UpdatedEvent.PupilIdOld = 5000; UpdatedEvent.EventTime = TimeSpan.FromMilliseconds(1000); UpdatedEvent.NotifyWasSend = false; UpdatedEvent.EventName = "Ушёл не слишком рано"; MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests");; msDbSetter.SetUpdatedEvent(UpdatedEvent); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); String EventName = msDbRequester.getEventNameByPupilIdOld(5000); msDbSetter.SetDelAllEventsForTesting(); Assert.IsTrue(EventName == "Ушёл не слишком рано"); }
//Загрузка содержимого таблицы private void DataGrid_Loaded(object sender, RoutedEventArgs e) { List <MyTable> result = new List <MyTable>(); MsDbRequester MsDbRequester = new MsDbRequester(); var allPupils = MsDbRequester.getListAllPupils(); foreach (Pupil p in allPupils) { MyTable MyTable = new MyTable(p.EljurAccountId, p.FullFIO, p.Clas, p.PupilIdOld, p.NotifyEnable); result.Add(MyTable); } DataTable table = new DataTable(); table.Columns.Add("ИД ЭлЖур", typeof(int)); table.Columns.Add("Ученик", typeof(string)); table.Columns.Add("Класс", typeof(string)); table.Columns.Add("СкудИд", typeof(int)); table.Columns.Add("Уведомлять", typeof(bool)); foreach (MyTable t in result) { DataRow row = table.NewRow(); row["ИД ЭлЖур"] = t.IdEljur; row["Ученик"] = t.FIO; row["Класс"] = t.Class; row["СкудИд"] = t.PupilIdOld; row["Уведомлять"] = t.NotifyEnable; table.Rows.Add(row); } PupulsDataGrid.ItemsSource = table.DefaultView; PupulsDataGrid.BeginningEdit += DataGrid_BeginningEdit; }
public void AddNewEventTest() { PrepareTestEvent(); MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests"); msDbSetter.SetDelAllEventsForTesting(); var TestListEvents = new List <object[]>(); TestListEvents = PrepareTestListEvents(1); MsDb msDb = new MsDb("name=StaffContextTests"); MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests"); msDb.AddNewEvent(TestListEvents.First(), 5000); String EventName = msDbRequester.getEventNameByPupilIdOld(5000); Assert.IsTrue(EventName == "Первый проход"); msDbSetter.SetDelAllEventsForTesting(); TestListEvents = PrepareTestListEvents(3); msDb.AddNewEvent(TestListEvents.First(), 5000); EventName = msDbRequester.getEventNameByPupilIdOld(5000); TestContext.WriteLine(EventName); Assert.IsTrue(EventName == null); }
public EljurBaseClass(Message Message, MsDbRequester MsDbRequester, MsDbSetter MsDbSetter) { this.message = Message; this.msDbRequester = MsDbRequester; this.msDbSetter = MsDbSetter; }