Ejemplo n.º 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 == "Опоздал");
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }
        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);
        }
Ejemplo n.º 7
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 == "Ушёл не слишком рано");
        }
Ejemplo n.º 9
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);
        }