public void TestDelete() { Schedule schedule = new Schedule(); schedule.EventTitle = "Test title"; schedule.EventDescription = "Description"; schedule.StartTime = "2018-01-22 22:11:32"; Assert.True(ScheduleDBConnector.Create(dataSource, schedule)); List <Schedule> schedules = ScheduleDBConnector.GetSchedules(dataSource, "SELECT * FROM Schedule ORDER BY datetime(StartTime)"); Assert.NotNull(schedules); Assert.True(FaqDBConnector.Delete(dataSource, (int)schedules[0].Id)); }
public void TestInsert() { List <Schedule> schedules = ScheduleDBConnector.GetSchedules(dataSource, "SELECT * FROM Schedule ORDER BY datetime(StartTime)"); Assert.NotNull(schedules); int count = schedules.Count; Schedule schedule = new Schedule(); schedule.EventTitle = "Test title"; schedule.EventDescription = "Description"; schedule.StartTime = "2018-01-22 22:11:32"; Assert.True(ScheduleDBConnector.Create(dataSource, schedule)); schedules = ScheduleDBConnector.GetSchedules(dataSource, "SELECT * FROM Schedule ORDER BY datetime(StartTime)"); Assert.NotNull(schedules); Assert.Equal(count + 1, schedules.Count); }
public IActionResult Add(Schedule schedule) { ScheduleDBConnector.Create(Constants.DATA_SOURCE, schedule); return(Redirect("/Schedule")); }