public void DeleteEventsWithGivenTitle() { IEventsManager eventsManager = new EventsManagerFast(); eventsManager.AddEvent(sampleEvent); eventsManager.DeleteEventsByTitle(sampleEvent.Title); Assert.AreEqual(0, eventsManager.ListEvents(DateTime.MinValue, int.MaxValue).Count()); }
public void TestDeleteEventsByTitle_WhenNoEevntsAreAdded() { EventsManagerFast eventsManager = new EventsManagerFast(); int numberOfDeletedEvents = eventsManager.DeleteEventsByTitle("Title"); Assert.AreEqual(0, numberOfDeletedEvents); }
public void DeleteEventsByCaseInsensitiveTitle() { IEventsManager eventsManager = new EventsManagerFast(); eventsManager.AddEvent(new Event { Date = DateTime.Now, Location = "Telerik Academy", Title = "High-Quality Code Exam", }); eventsManager.AddEvent(new Event { Date = DateTime.Now, Location = "Telerik Academy", Title = "HIGH-Quality CODE Exam", }); eventsManager.DeleteEventsByTitle("HIGH-Quality CODE Exam".ToLower()); Assert.AreEqual(0, eventsManager.ListEvents(DateTime.MinValue, int.MaxValue).Count()); }
public void TestDeleteEventsByTitle_WhenMultipleEventsAreAddedAndOnlyOneMatches() { EventsManagerFast eventsManager = new EventsManagerFast(); for (int i = 0; i < 10; i++) { eventsManager.AddEvent(new Event(DateTime.Now, "Title")); } eventsManager.AddEvent(new Event(DateTime.Now, "Title1")); int numberOfDeletedEvents = eventsManager.DeleteEventsByTitle("Title1"); Assert.AreEqual(1, numberOfDeletedEvents); }
public void TestDeleteEventsByTitle_WhenMultipleEventsAreAddedAndNoneOfThemMatch() { EventsManagerFast eventsManager = new EventsManagerFast(); int totalNumberOfEvents = 10; for (int i = 0; i < totalNumberOfEvents; i++) { eventsManager.AddEvent(new Event(DateTime.Now, "Title")); } int numberOfDeletedEvents = eventsManager.DeleteEventsByTitle("Title1"); Assert.AreEqual(0, numberOfDeletedEvents); }
public void TestDeleteEventsByTitle_WhenMultipleEventsAreAddedAndSomeOfThemMatch() { EventsManagerFast eventsManager = new EventsManagerFast(); int totalNumberOfEvents = 10; for (int i = 0; i < totalNumberOfEvents; i++) { string titleIndex = (i % 2).ToString(); eventsManager.AddEvent(new Event(DateTime.Now, "Title" + titleIndex)); } int numberOfDeletedEvents = eventsManager.DeleteEventsByTitle("Title0"); Assert.AreEqual(totalNumberOfEvents / 2, numberOfDeletedEvents); }
public void DeleteEventTest() { EventsManagerFast fastManager = new EventsManagerFast(); var firstDate = DateTime.ParseExact("2012-01-21T20:00:00", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); var secondDate = DateTime.ParseExact("2012-05-21T20:00:00", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); Event firstEvent = new Event(firstDate, "Party 1", "Sofia"); Event secondEvent = new Event(secondDate, "Party 2", "Burgas"); fastManager.AddEvent(firstEvent); fastManager.AddEvent(secondEvent); int expected = fastManager.DeleteEventsByTitle("Party 2"); int actual = 1; Assert.AreEqual(1, fastManager.Count); Assert.AreEqual(expected, actual); }
public void DeleteElementsInEmptyList() { EventsManagerFast fastManager = new EventsManagerFast(); int expected = fastManager.DeleteEventsByTitle("Party 1"); int actual = 0; Assert.AreEqual(expected, actual); }
public void TestDeleteEventsByTitle_WhenSingleEventIsAddedAndMatches() { EventsManagerFast eventsManager = new EventsManagerFast(); eventsManager.AddEvent(new Event(DateTime.Now, "Title")); int numberOfDeletedEvents = eventsManager.DeleteEventsByTitle("Title"); Assert.AreEqual(1, numberOfDeletedEvents); }
public void TestDeleteMultipleEventsWithSameTitle() { EventsManagerFast eventManager = new EventsManagerFast(); Event ev = new Event(); ev.Title = "C# course - 756828"; ev.Date = DateTime.ParseExact("2001-01-01T10:30:01", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); ev.Location = "Telerik academy"; eventManager.AddEvent(ev); Event ev2 = new Event(); ev2.Title = "Chalga party"; ev2.Date = DateTime.ParseExact("2001-01-01T10:30:01", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); ev2.Location = "Sofia - 230340"; eventManager.AddEvent(ev2); Event ev3 = new Event(); ev3.Title = "C# course - 756828"; ev3.Date = DateTime.ParseExact("2001-01-01T10:30:01", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); ev3.Location = "Sofia - 230340"; eventManager.AddEvent(ev3); Event ev4 = new Event(); ev4.Title = "party Kiro"; ev4.Date = DateTime.ParseExact("2001-01-01T10:30:01", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); ev4.Location = "Sofia - 230340"; eventManager.AddEvent(ev4); var deletedEventsCount = eventManager.DeleteEventsByTitle("C# course - 756828"); Assert.AreEqual(2, deletedEventsCount); Assert.AreEqual(1, eventManager.EventsByDateCount); Assert.AreEqual(2, eventManager.EventsByTitleCount); }
public void TestDeleteNonExistingEvent() { EventsManagerFast eventManager = new EventsManagerFast(); Event ev = new Event(); ev.Title = "C# course - 756828"; ev.Date = DateTime.ParseExact("2001-01-01T10:30:01", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); ev.Location = "Telerik academy"; eventManager.AddEvent(ev); Event ev2 = new Event(); ev2.Title = "EXAM - 564705"; ev2.Date = DateTime.ParseExact("2001-01-01T10:30:01", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); ev2.Location = "Sofia - 230340"; eventManager.AddEvent(ev2); var deletedEventsCount = eventManager.DeleteEventsByTitle("Non existing event"); Assert.AreEqual(0, deletedEventsCount); }
public void TestDeleteEvent() { var date = DateTime.ParseExact( "2012-03-26T09:00:00", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); string title = "C# exam"; var ev = new Event { date = date, Title = title, Location = null, }; EventsManagerFast manager = new EventsManagerFast(); manager.AddEvent(ev); string titleToDelete = "C# exam";; int actual = manager.DeleteEventsByTitle(titleToDelete); int expected = 1; Assert.AreEqual(expected, actual); }
public void TestDeleteEvents_WhenNoMatches() { EventsManagerFast manager = new EventsManagerFast(); //first event string titleCSharp = "C# exam"; var dateCSharp = DateTime.ParseExact( "2012-03-26T09:00:00", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); string locationCSharp = "Home"; var evCSharp1 = new Event { date = dateCSharp, Title = titleCSharp, Location = locationCSharp, }; manager.AddEvent(evCSharp1); //second event string title = "C++ exam"; var dateCPlus = DateTime.ParseExact( "2011-02-26T09:00:00", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); string locationCPlus = "Academy"; var evCPlus = new Event { date = dateCPlus, Title = title, Location = locationCPlus, }; //third event string titleCSharp2 = "C# exam"; var dateCSharp2 = DateTime.ParseExact( "2012-03-26T09:00:00", "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture); string locationCSharp2 = "Home"; var evCSharp2 = new Event { date = dateCSharp2, Title = titleCSharp2, Location = locationCSharp2, }; manager.AddEvent(evCSharp2); string titleToDelete = "exam"; ; int actual = manager.DeleteEventsByTitle(titleToDelete); int expected = 0; Assert.AreEqual(expected, actual); }
public void DeleteEventsWithNullTitle() { IEventsManager eventsManager = new EventsManagerFast(); eventsManager.DeleteEventsByTitle(null); }