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

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

            SettingService settingService = new(context);

            var service = new ReservationsService(context, settingService);

            // Act
            var reservation = await service.GetReservation <ReservationViewModel>(
                Reservations.Reservation2User4Room2NoClient.Id);

            // Assert
            Assert.AreEqual(Reservations.Reservation2User4Room2NoClient.Id, reservation.Id);
            Assert.AreEqual(Reservations.Reservation2User4Room2NoClient.ReleaseDate, reservation.ReleaseDate);
            Assert.AreEqual(Reservations.Reservation2User4Room2NoClient.Price, reservation.Price);
            Assert.AreEqual(Reservations.Reservation2User4Room2NoClient.AllInclusive, reservation.AllInclusive);
            Assert.AreEqual(Reservations.Reservation2User4Room2NoClient.Breakfast, reservation.Breakfast);
        }