public void TestGetEvents() { DateTime now = DateTime.Now; SqlClass.AddTestEvent(new Event("e1", now)); SqlClass.AddTestEvent(new Event("e2", now)); SqlClass.AddTestEvent(new Event("e3", now.AddDays(1))); Assert.AreEqual(SqlClass.GetTestEvents(now).Count, 2); Assert.AreEqual(SqlClass.GetTestEvents(now.AddDays(1)).Count, 1); }
public void TestAddEvent() { DateTime now = DateTime.Now; DateTime dt = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, 0); // important to use 0 for seconds since dbmanager doesn't store seconds Event e = new Event("testEvent", dt, "testDescription"); List <Event> events_before = SqlClass.GetTestEvents(dt); SqlClass.AddTestEvent(e); List <Event> events_after = SqlClass.GetTestEvents(dt); Assert.AreEqual(events_before.Count + 1, events_after.Count); //Assert.AreEqual(events_after[0], e); }