Example #1
0
        public void MonthShouldContainsEvents()
        {
            var dateTime = new DateTime(2020, 1, 1);
            var month    = new Month(dateTime);
            var events   = new List <Event>
            {
                new Event(1, "Name", dateTime, dateTime, false)
            };

            month.AddEvents(events);

            var eventsOfMonth = month.Days.Where(day => day.Events.Any());

            Assert.IsNotEmpty(eventsOfMonth);
            Assert.AreEqual(1, eventsOfMonth.Count());
        }
Example #2
0
        public void EventsFromAnotherMonthNotShouldBeAdded()
        {
            var dateTime = new DateTime(2020, 1, 1);
            var month    = new Month(dateTime);
            var events   = new List <Event>
            {
                new Event(1, "Name", dateTime, dateTime, false),
                new Event(2, "Name", dateTime.AddMonths(1), dateTime.AddMonths(1), false)
            };

            month.AddEvents(events);

            var eventsOfMonth = month.Days.Where(day => day.Events.Any());

            Assert.IsNotEmpty(eventsOfMonth);
            Assert.AreEqual(1, eventsOfMonth.Count());
        }
Example #3
0
        public void AllEventsOfMonthShouldBeRemoved()
        {
            var dateTime          = new DateTime(2020, 1, 1);
            var month             = new Month(dateTime);
            var calendarViewEvent = new Event(1, "Name", dateTime, dateTime, false);
            var events            = new List <Event> {
                calendarViewEvent
            };

            month.AddEvents(events);

            month.RemoveAllEvents();

            var eventsOfMonth = month.Days.Where(day => day.Events.Any());

            Assert.IsEmpty(eventsOfMonth);
        }
Example #4
0
        public void EventsFromAnotherMonthNotShouldBeRemoved()
        {
            var dateTime          = new DateTime(2020, 1, 1);
            var month             = new Month(dateTime);
            var calendarViewEvent = new Event(1, "Name", dateTime, dateTime, false);
            var events            = new List <Event> {
                calendarViewEvent
            };

            month.AddEvents(events);
            var eventFromPreviousMonth = new Event(1, "Name", dateTime.AddMonths(-1), dateTime.AddMonths(-1), false);

            month.RemoveEvent(eventFromPreviousMonth);

            var eventsOfMonth = month.Days.Where(day => day.Events.Any());

            Assert.IsNotEmpty(eventsOfMonth);
        }