public void GetAllEventsTest1() { GetAllEvents allEvents = new GetAllEvents(); var events = allEvents.Get(connection); if (events.Count == 100) { Assert.Pass(); } else { Assert.Fail("В таблице не все записи"); } }
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("Ошибка изменения"); } }
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("Ошибка удаления"); } }
Task <IEnumerable <Event> > IRequestHandler <GetAllEvents, IEnumerable <Event> > .Handle(GetAllEvents request, CancellationToken cancellationToken) { return(this._eventsRepository.GetAll(cancellationToken)); }
public EventEditDateRequests() { getRequest = new GetAllEvents(); updateRequest = new UpdateEventDate(); }