コード例 #1
0
        public void AddEventMethodWithDuplicatedDateCheckTitlesCollectionTest()
        {
            EventsManagerFast eventsManager = new EventsManagerFast();

            DateTime firstDate = new DateTime(2002, 01, 02, 02, 02, 02);
            CalendarEvent firstEvent = new CalendarEvent(firstDate, "Title1", null);

            DateTime secondDate = new DateTime(2002, 01, 02, 02, 02, 02);
            CalendarEvent secondEvent = new CalendarEvent(secondDate, "Title2", null);

            eventsManager.AddEvent(firstEvent);
            eventsManager.AddEvent(secondEvent);

            Assert.AreEqual(2, eventsManager.TitlesColection.Count);
        }
コード例 #2
0
        public void AddEventMethodCheckTitlesCollectionRegularTest()
        {
            EventsManagerFast eventsManager = new EventsManagerFast();
            DateTime date = new DateTime(2002, 01, 02, 02, 02, 02);
            CalendarEvent singleEvent = new CalendarEvent(date, "Title", null);

            eventsManager.AddEvent(singleEvent);
            Assert.AreEqual(1, eventsManager.TitlesColection.Count);
        }
コード例 #3
0
        public void DeleteEventsByTitleMethodWhenSuchTitleNoExistTest()
        {
            EventsManagerFast eventsManager = new EventsManagerFast();
            DateTime date = new DateTime(2002, 01, 02, 02, 02, 02);
            CalendarEvent singleEvent = new CalendarEvent(date, "Title", null);

            eventsManager.AddEvent(singleEvent);
            int numberOfDeletedEvents = eventsManager.DeleteEventsByTitle("exam");
            Assert.AreEqual(0, numberOfDeletedEvents);
        }
コード例 #4
0
        public void ListEventsWithMoreElementsThanWishedTest()
        {
            EventsManagerFast eventsManager = new EventsManagerFast();

            DateTime firstDate = new DateTime(2002, 01, 02, 02, 02, 02);
            CalendarEvent firstEvent = new CalendarEvent(firstDate, "Title", null);

            DateTime secondDate = new DateTime(2003, 01, 02, 02, 02, 02);
            CalendarEvent secondEvent = new CalendarEvent(secondDate, "Title", null);

            DateTime thirdDate = new DateTime(2003, 01, 02, 02, 02, 02);
            CalendarEvent thirdEvent = new CalendarEvent(thirdDate, "Title", null);

            eventsManager.AddEvent(firstEvent);
            eventsManager.AddEvent(secondEvent);
            eventsManager.AddEvent(thirdEvent);

            DateTime startDate = new DateTime(2001, 01, 02, 00, 00, 00);
            IEnumerable<CalendarEvent> resultList = eventsManager.ListEvents(startDate, 2);

            int count = 0;
            foreach (var ev in resultList)
            {
                count = count + 1;
            }

            Assert.AreEqual(2, count);
        }
コード例 #5
0
        public void DeleteEventsByTitleMethodCheckTitlesCollectionTest()
        {
            EventsManagerFast eventsManager = new EventsManagerFast();

            DateTime firstDate = new DateTime(2002, 01, 02, 02, 02, 02);
            CalendarEvent firstEvent = new CalendarEvent(firstDate, "Title", null);

            DateTime secondDate = new DateTime(2003, 01, 02, 02, 02, 02);
            CalendarEvent secondEvent = new CalendarEvent(secondDate, "Title", null);

            eventsManager.AddEvent(firstEvent);
            eventsManager.AddEvent(secondEvent);

            int numberOfDeletedEvents = eventsManager.DeleteEventsByTitle("Title");

            Assert.AreEqual(2, numberOfDeletedEvents);
        }