Beispiel #1
0
        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 == "Опоздал");
        }
Beispiel #2
0
        void PrepareTestSchedule()
        {
            MsDbSetter msDbSetter   = new MsDbSetter("name=StaffContextTests");
            Schedule   TestSchedule = new Schedule();

            TestSchedule.Clas             = "1Б";
            TestSchedule.StartTimeLessons = TimeSpan.FromMilliseconds(10000);
            TestSchedule.EndTimeLessons   = TimeSpan.FromMilliseconds(20000);
            msDbSetter.SetDelAllSchedulesForTesting();
            msDbSetter.SetTestScheduleForTesting(TestSchedule);
        }
Beispiel #3
0
        void PrepareTestEvent()
        {
            MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests");
            Event      TestEvent  = new Event();

            TestEvent.PupilIdOld    = 5000;
            TestEvent.EventTime     = TimeSpan.FromMilliseconds(1000);
            TestEvent.NotifyWasSend = false;
            TestEvent.EventName     = "Ушёл слишком рано";
            msDbSetter.SetDelAllEventsForTesting();
            msDbSetter.SetOneFullEventForTesting(TestEvent);
        }
Beispiel #4
0
        void PrepareTestEvent()
        {
            MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests");
            Event      TestEvent  = new Event();

            TestEvent.PupilIdOld    = 5000;
            TestEvent.EventTime     = DateTime.Now.TimeOfDay;
            TestEvent.NotifyWasSend = false;
            TestEvent.EventName     = "Первый проход";
            msDbSetter.SetDelAllEventsForTesting();
            msDbSetter.SetOneFullEventForTesting(TestEvent);
        }
Beispiel #5
0
        void PrepareTestSchedule()
        {
            MsDbSetter msDbSetter   = new MsDbSetter("name=StaffContextTests");
            Schedule   TestSchedule = new Schedule();

            TestSchedule.Clas             = "1Б";
            TestSchedule.StartTimeLessons = DateTime.Now.TimeOfDay;
            TestSchedule.EndTimeLessons   = DateTime.Now.TimeOfDay;

            msDbSetter.SetDelAllSchedulesForTesting();
            msDbSetter.SetTestScheduleForTesting(TestSchedule);
        }
        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 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 IsTableEmptyTest()
        {
            PrepareTestEvent();
            EmptyChecker EmptyChecker = new EmptyChecker("StaffContextTests");
            Boolean      IsTableEmpty = EmptyChecker.IsTableEmpty("Events");

            Assert.IsTrue(IsTableEmpty == false);
            MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests");

            msDbSetter.SetDelAllEventsForTesting();
            IsTableEmpty = EmptyChecker.IsTableEmpty("Events");
            Assert.IsTrue(IsTableEmpty == true);
        }
 public EljurBaseClass(Message Message, Config Config, MsDb MsDb, Firebird Firebird,
                       TimeChecker TimeChecker, EljurApiSender EljurApiSender, MsDbCatcherFirstPass MsDbCatcherFirstPass, MsDbCatcherLastPass MsDbCatcherLastPass,
                       MsDbSetter MsDbSetter)
 {
     this.message              = Message;
     this.config               = Config;
     this.msDb                 = new MsDb("name=StaffContext", config.ConfigsTreeIdResourceOutput1, config.ConfigsTreeIdResourceOutput2, config.ConfigsTreeIdResourceInput1, config.ConfigsTreeIdResourceInput2);
     this.firebird             = Firebird;
     this.timeChecker          = new TimeChecker(config.timeFromDel, config.timeToDel);
     this.eljurApiSender       = EljurApiSender;
     this.msDbCatcherFirstPass = MsDbCatcherFirstPass;
     this.msDbCatcherLastPass  = MsDbCatcherLastPass;
     this.msDbSetter           = MsDbSetter;
 }
        void PrepareTestPupil()
        {
            MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests");
            Pupil      TestPupil  = new Pupil();

            TestPupil.PupilIdOld     = 5005;
            TestPupil.FirstName      = "Тест";
            TestPupil.LastName       = "Тестов";
            TestPupil.MiddleName     = "Тестович";
            TestPupil.FullFIO        = "Тестов Тест Тестович";
            TestPupil.Clas           = "1Б";
            TestPupil.EljurAccountId = 666;
            msDbSetter.SetDelAllPupilsForTesting();
            msDbSetter.SetOneTestPupilForTesting(TestPupil);
        }
        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 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 == "Ушёл не слишком рано");
        }
Beispiel #13
0
        void PrepareTestEvent()
        {
            MsDbSetter msDbSetter = new MsDbSetter("name=StaffContextTests");
            Event      TestEvent1 = new Event();

            TestEvent1.PupilIdOld    = 5000;
            TestEvent1.EventTime     = TimeSpan.FromMilliseconds(10000);
            TestEvent1.NotifyWasSend = false;
            TestEvent1.EventName     = "Прогул";
            Event TestEvent2 = new Event();

            TestEvent2.PupilIdOld    = 5001;
            TestEvent2.EventTime     = TimeSpan.FromMilliseconds(1000);
            TestEvent2.NotifyWasSend = false;
            TestEvent2.EventName     = "Первый проход";
            msDbSetter.SetDelAllEventsForTesting();
            msDbSetter.SetOneFullEventForTesting(TestEvent1);
            msDbSetter.SetOneFullEventForTesting(TestEvent2);
        }
        //Запись в базу
        private void cellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            var editedCheckbox = e.EditingElement as CheckBox;

            if (editedCheckbox != null)
            {
                bool flag = editedCheckbox.IsChecked.Value;

                DataGridRow CurRow = e.Row;
                object      data   = CurRow.Item;
                DataRowView drv    = data as DataRowView;

                //MessageBox.Show(drv[3].ToString());
                //MessageBox.Show(flag.ToString());

                MsDbSetter MsDbSetter = new MsDbSetter();
                MsDbSetter.SetNotifyEnableByPupilIdOld(Convert.ToInt32(drv[3]), flag);
            }
        }
Beispiel #15
0
        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;
 }