Ejemplo n.º 1
0
        public void RemoveCalendar_InvalidCalendarId_ReturnFalse()
        {
            var calendarRepo = new CalendarRepository(_context);
            var actual       = calendarRepo.DeleteCalendar(2);

            Assert.False(actual);
        }
Ejemplo n.º 2
0
        public void RemoveCalendar_ValidCalendarId_ReturnTrue()
        {
            var calendar1 = new Calendar
            {
                Name        = "Calendar 1",
                Description = "",
                User        = null,
                UserId      = 1,
                Events      = null
            };
            var calendar2 = new Calendar
            {
                Name        = "Calendar 2",
                Description = "",
                User        = null,
                UserId      = 1,
                Events      = null
            };

            _context.AddRange(calendar1, calendar2);
            _context.SaveChanges();

            var calendarRepo = new CalendarRepository(_context);

            var actual = calendarRepo.DeleteCalendar(1);

            Assert.True(actual);
        }
Ejemplo n.º 3
0
        public void GetCalendars_ShouldntReturnDeletedCalendars()
        {
            var expectedCalendars = new List <Calendar>();

            for (int i = 0; i < 5; ++i)
            {
                var calendar = CreateAndRetrieveCalendar();
                expectedCalendars.Add(calendar);
            }
            var deletedCalendar = CreateAndRetrieveCalendar();

            repository.DeleteCalendar(deletedCalendar.CalendarId);

            var calendars = repository.GetCalendars(GetFirstPage()).Result.Results;

            CollectionAssert.AreEquivalent(expectedCalendars, calendars);
        }
Ejemplo n.º 4
0
 public async Task DeleteCalendar(Calendar calendar)
 {
     calendarRepository.DeleteCalendar(calendar.CalendarId);
 }