Пример #1
0
        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 == "Вернулся");
        }
Пример #2
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 == "Опоздал");
        }
        public void SetOneFullEventForTestingTest()
        {
            PrepareTestEvent();
            MsDbRequester msDbRequester = new MsDbRequester("name=StaffContextTests");
            String        EventName     = msDbRequester.getEventNameByPupilIdOld(5000);

            Assert.IsTrue(EventName == "Ушёл слишком рано");
        }
        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 == "Опоздал");
        }
Пример #5
0
        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 == "Вернулся");
        }
Пример #6
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 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 == "Ушёл не слишком рано");
        }