Пример #1
0
        public void GetUserCalendars_CalendarsForMultipleUsers_ReturnsOnlyCalendarsForGivenUser()
        {
            var calendar1 = new Calendar
            {
                Name        = "Calendar 1",
                Description = "Description 1",
                User        = null,
                UserId      = 1,
                Events      = null
            };
            var calendar2 = new Calendar
            {
                Name        = "Calendar 2",
                Description = "Description 2",
                User        = null,
                UserId      = 2,
                Events      = null
            };

            _context.AddRange(calendar1, calendar2);
            _context.SaveChanges();
            var calendarRepo = new CalendarRepository(_context);

            var actual = calendarRepo.GetUserCalendars(1);

            Assert.Collection(actual,
                              calendar => Assert.Contains("Calendar 1", calendar.Name));
        }