Example #1
0
        public async Task UpdateReservation_ShouldNotUpdateReservation()
        {
            // Arange
            List <Reservation> reservationsData = new()
            {
                Reservations.Reservation1User3Room1NoClient
            };

            List <Setting> settings = new()
            {
                Settings.AllInclusive,
                Settings.Breakfast
            };

            List <ApplicationUser> users = new()
            {
                Users.User3NotEmployee
            };

            List <ClientData> clients = new()
            {
                new ClientData
                {
                    Id       = null,
                    Email    = "email",
                    FullName = "name"
                }
            };

            ApplicationDbContext context = await InMemoryFactory.InitializeContext()
                                           .SeedAsync(settings)
                                           .SeedAsync(users);

            context.Reservations.RemoveRange(context.Reservations.ToList());
            context.AddRange(reservationsData);
            context.SaveChanges();

            SettingService settingService = new(context);

            var service = new ReservationsService(context, settingService);

            // Act
            var result = await service.UpdateReservation(Reservations.Reservation1User3Room1NoClient.Id,
                                                         DateTime.Today.AddDays(7),
                                                         DateTime.Today.AddDays(9),
                                                         Reservations.UpdateAllInClusive1,
                                                         Reservations.UpdateBreakfast1,
                                                         clients,
                                                         Users.User1Employee);

            // Assert
            Assert.IsFalse(result);
        }