コード例 #1
0
        public void GetAllEventsTest1()
        {
            GetAllEvents allEvents = new GetAllEvents();
            var          events    = allEvents.Get(connection);

            if (events.Count == 100)
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail("В таблице не все записи");
            }
        }
コード例 #2
0
        public void UpdateEventDateTest1()
        {
            UpdateEventDate update    = new UpdateEventDate();
            GetAllEvents    allEvents = new GetAllEvents();
            DateTime        date      = DateTime.Today;

            var events = allEvents.Get(connection);
            int ID     = 0;

            foreach (EventModel @event in events)
            {
                if (@event.DateOfEvent.Equals(date))
                {
                    ID = @event.ID;
                }
            }

            date = DateTime.Parse("16.02.1999");
            EventModel model = new EventModel(ID, date, $"TestEvent № 155");

            update.Update(model, connection);

            allEvents = new GetAllEvents();
            events    = allEvents.Get(connection);
            bool passFlag = false;

            foreach (EventModel @event in events)
            {
                if (@event.DateOfEvent.Equals(date))
                {
                    passFlag = true;
                }
            }

            if (passFlag)
            {
                Assert.Pass("Элемент изменен");
            }
            else
            {
                Assert.Fail("Ошибка изменения");
            }
        }
コード例 #3
0
        public void DeleateEventTest1()
        {
            DeleateEvent deleateEvent = new DeleateEvent();
            GetAllEvents allEvents    = new GetAllEvents();
            DateTime     date         = DateTime.Today;

            var events = allEvents.Get(connection);
            int ID     = 0;

            foreach (EventModel @event in events)
            {
                if (@event.Event.Equals("TestEvent № 55"))
                {
                    ID = @event.ID;
                }
            }

            EventModel model = new EventModel(ID, date, $"TestEvent № {55}");

            deleateEvent.Deleate(model, connection);

            allEvents = new GetAllEvents();
            events    = allEvents.Get(connection);
            bool passFlag = true;

            foreach (EventModel @event in events)
            {
                if (@event.Event.Equals("TestEvent № 55"))
                {
                    passFlag = false;
                }
            }

            if (passFlag)
            {
                Assert.Pass("Элемент отсутсвует в БД");
            }
            else
            {
                Assert.Fail("Ошибка удаления");
            }
        }
コード例 #4
0
 Task <IEnumerable <Event> > IRequestHandler <GetAllEvents, IEnumerable <Event> > .Handle(GetAllEvents request, CancellationToken cancellationToken)
 {
     return(this._eventsRepository.GetAll(cancellationToken));
 }
コード例 #5
0
 public EventEditDateRequests()
 {
     getRequest    = new GetAllEvents();
     updateRequest = new UpdateEventDate();
 }