示例#1
0
        public async Task GetReservationsForUser_ReturnsUsersReservations()
        {
            // Arange
            List <Reservation> reservationsData = new()
            {
                Reservations.Reservation1User3Room1NoClient,
                Reservations.Reservation2User4Room2NoClient,
                Reservations.Reservation3User4Room2NoClient
            };

            ApplicationDbContext context = await InMemoryFactory.InitializeContext()
                                           .SeedAsync(reservationsData);

            SettingService settingService = new(context);

            var service = new ReservationsService(context, settingService);

            // Act
            var userReservations = await service.GetReservationsForUser <ReservationViewModel>(
                Users.User4NotEmployee.Id);

            // Assert
            Assert.AreEqual(context.Reservations.Count(x => x.User.Id == Users.User4NotEmployee.Id), userReservations.Count());
        }