public void AddEventTest() { DataChamber data = new DataChamber(); DefaultDataGeneration filler = new DefaultDataGeneration(); DatabaseActions test = new DatabaseActions(data, filler); Users user = new Users(1, "Wojciech", "Mincikiewicz", 1996); Catalog catalog = new Catalog("Andrzej", "Sapkowski", 2000, "The Witcher", 8); ProcessState processState = new ProcessState(catalog, "Znak", 1990, "Good"); DateTime checkOutDate = new DateTime(2010, 10, 12); DateTime checkInDate = new DateTime(1993, 4, 6); Event evn = new Event(processState, user, checkOutDate, checkInDate); test.AddEvent(evn); Assert.AreEqual(test.ReadEvent(5), evn); }
public void DeleteEventTest() { DefaultDataGeneration filler = new DefaultDataGeneration(); DataChamber data = new DataChamber(); DatabaseActions test = new DatabaseActions(data, filler); Users newUser = new Users(1, "Test", "Testowy", 1908); Catalog newCatalog = new Catalog("Lokok", "Test", 1908, "Testowy", 9); ProcessState newProcessState = new ProcessState(newCatalog, "Testowy", 1789, "Bad"); DateTime checkOutDate = new DateTime(2000, 10, 12); DateTime checkInDate = new DateTime(1990, 4, 6); Event newEvent = new Event(newProcessState, newUser, checkOutDate, checkInDate); test.AddEvent(newEvent); Assert.AreEqual(test.ReadEvent(5), newEvent); test.DeleteEvent(5); Assert.IsFalse(test.ReadAllEvents().Contains(newEvent)); }