public void DeleteEventsByCaseInsensitiveTitle()
 {
     IEventsManager eventsManager = new EventsManagerFast();
     eventsManager.AddEvent(new Event(DateTime.Now, "High-Quality Code Exam", "Telerik Academy"));
     eventsManager.AddEvent(new Event(DateTime.Now, "HIGH-Quality CODE Exam", "Telerik Academy"));
     eventsManager.DeleteEventsByTitle("HIGH-Quality CODE Exam".ToLower());
     Assert.AreEqual(0, eventsManager.ListEvents(DateTime.MinValue, int.MaxValue).Count());
 }
 public void AddDuplicateEvents()
 {
     IEventsManager eventsManager = new EventsManagerFast();
     eventsManager.AddEvent(sampleEvent);
     eventsManager.AddEvent(sampleEvent);
     eventsManager.AddEvent(sampleEvent);
     Assert.AreEqual(3, eventsManager.ListEvents(DateTime.MinValue, int.MaxValue).Count());
 }
 public void ListEventsByDate()
 {
     IEventsManager eventsManager = new EventsManagerFast();
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 10, 00, 00), "Exam Morning", "Telerik Academy"));
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 16, 30, 00), "Exam Evening", "Telerik Academy"));
     var dateCriteria = new DateTime(2013, 05, 20, 12, 00, 00);
     var result = eventsManager.ListEvents(dateCriteria, int.MaxValue).ToList();
     Assert.AreEqual(1, result.Count);
     Assert.AreEqual("Exam Evening", result[0].Title);
 }
Ejemplo n.º 4
0
        public void DuplicateEventsAreAccepted()
        {
            EventsManagerFast manager = new EventsManagerFast();
            var ev = new Event(minDate, "test", null);
            manager.AddEvent(ev);
            manager.AddEvent(ev);

            var actual = manager.ListEvents(minDate, 2).Count();

            Assert.AreEqual(2, actual);
        }
Ejemplo n.º 5
0
        public void EventsAreListedSorted()
        {
            EventsManagerFast manager = new EventsManagerFast();

            // Unsorted events
            var events = new List<Event>
            {
                new Event(DateTime.Parse("2010-01-01"), "testB", "foo"),
                new Event(minDate, "test", null),
                new Event(minDate, "test", "bar"),
                new Event(minDate, "test", "foo"),
                new Event(minDate, "testB", "foo")                
            };

            // Events are added unsorted
            foreach (var ev in events)
            {
                manager.AddEvent(ev);
            }

            var managerEvents = manager.ListEvents(minDate, 5).ToList();

            // Assert 5 are added
            Assert.AreEqual(5, managerEvents.Count);

            events.Sort();
            CollectionAssert.AreEqual(events, managerEvents);
        }
 public void DeleteEventsWithGivenNoMatchingTitle()
 {
     IEventsManager eventsManager = new EventsManagerFast();
     eventsManager.AddEvent(sampleEvent);
     eventsManager.DeleteEventsByTitle("High");
     Assert.AreEqual(1, eventsManager.ListEvents(DateTime.MinValue, int.MaxValue).Count());
 }
        public void DeleteMultipleEvents()
        {
            EventsManagerFast manager = new EventsManagerFast();

            manager.AddEvent(new Event(minDate, "test", null));
            manager.AddEvent(new Event(minDate, "test", "bar"));
            manager.AddEvent(new Event(minDate, "other", "bar"));

            int numDeleted = manager.DeleteEventsByTitle("test");

            Assert.AreEqual(2, numDeleted);

            var eventCount = manager.ListEvents(minDate, 3).Count();

            // assert "other" is not deleted
            Assert.AreEqual(1, eventCount);
        }
Ejemplo n.º 8
0
        public void AddedEventWitLocationIsCorrectlyReturned()
        {
            EventsManagerFast manager = new EventsManagerFast();
            var ev = new Event(minDate, "test", "bar");
            manager.AddEvent(ev);

            var actual = manager.ListEvents(minDate, 1).First();

            Assert.AreEqual<Event>(ev, actual);
        }
        public void DeleteSingleEvent()
        {
            EventsManagerFast manager = new EventsManagerFast();

            manager.AddEvent(new Event(minDate, "test", null));

            int numDeleted = manager.DeleteEventsByTitle("test");

            Assert.AreEqual(1, numDeleted);

            var eventCount = manager.ListEvents(minDate, 1).Count();

            Assert.AreEqual(0, eventCount);
        }
 public void ListEventsByDateAndLimitTheOutputCount()
 {
     IEventsManager eventsManager = new EventsManagerFast();
     const int CountLimit = 2;
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 10, 00, 00), "Exam", "Telerik Academy"));
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 16, 30, 00), "Exam", "Telerik Academy"));
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 17, 30, 00), "Exam", "Telerik Academy"));
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 18, 30, 00), "Exam", "Telerik Academy"));
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 19, 30, 00), "Exam", "Telerik Academy"));
     var dateCriteria = new DateTime(2013, 05, 20, 12, 00, 00);
     Assert.AreEqual(CountLimit, eventsManager.ListEvents(dateCriteria, CountLimit).Count());
 }
 public void AddNullEvent()
 {
     IEventsManager eventsManager = new EventsManagerFast();
     eventsManager.AddEvent(null);
 }
 public void NoEventsWillBeListedWhenCountIsZero()
 {
     IEventsManager eventsManager = new EventsManagerFast();
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 10, 00, 00), "Exam", "Telerik Academy"));
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 16, 30, 00), "Exam", "Telerik Academy"));
     var dateCriteria = DateTime.MinValue;
     Assert.AreEqual(0, eventsManager.ListEvents(dateCriteria, 0).Count());
 }
 public void NoEventsWillBeListedWithDateFarInTheFuture()
 {
     IEventsManager eventsManager = new EventsManagerFast();
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 10, 00, 00), "Exam", "Telerik Academy"));
     eventsManager.AddEvent(new Event(new DateTime(2013, 05, 20, 16, 30, 00), "Exam", "Telerik Academy"));
     var dateCriteria = DateTime.MaxValue;
     Assert.AreEqual(0, eventsManager.ListEvents(dateCriteria, int.MaxValue).Count());
 }