public void Deveria_cadastrar_reserva_com_um_clientes() { var hotel = HotelBuilder.Start().Build(); var customer = CustomerBuilder.Start().Build(); var hotelReservation = HotelReservationBuilder.Start().WithHotel(hotel).WithCustomer(customer).Build(); var result = hotelReservation.CanRegister(); result.Should().Be("Cadastro validado"); }
private void CreateHotelReservation() { HotelReservationSeed = HotelReservationBuilder.Start().WithCustomer(CustomerBuilder.Start().Build()).Build(); //HotelReservationSeed.SetId(); //foreach (var customer in HotelReservationSeed.HotelCustomers) //{ // customer.SetId(); //} HotelReservationSeed = _context.HotelReservation.Add(HotelReservationSeed).Entity; }
public void Nao_deveria_cadastrar_reserva_com_cliente_ja_cadastrado(int value1, int value2) { var customerRegistered = CustomerBuilder.Start().WithName("Dienisson").Build(); var hotelReservationRegistered = HotelReservationBuilder.Start().WithCustomer(customerRegistered).Build(); var hotel = HotelBuilder.Start().WithHotelReservation(hotelReservationRegistered).Build(); var customer = CustomerBuilder.Start().WithId(value1).WithName("Dienisson").Build(); var customeTwo = CustomerBuilder.Start().WithId(value2).Build(); var hotelReservationTwho = HotelReservationBuilder.Start() .WithCustomer(customer) .WithCustomer(customeTwo) .WithHotel(hotel) .Build(); var result = hotelReservationTwho.CanRegister(); result.Should().Be("Vaga já cadastrado: Dienisson"); }
public async Task Deveria_atualizar_reserva_de_hotel_com_sucesso() { int expected = 1; List <HotelReservation> reservations = new List <HotelReservation>() { HotelReservationBuilder.Start().Build(), HotelReservationBuilder.Start().Build() }; _fakeRepository.Setup(x => x.GetAll()).ReturnsAsync(reservations); var cmd = HotelReservationUpdateCommandBuilder.Start().Build(); var result = await _handler.Handle(cmd, It.IsAny <CancellationToken>()); result.Should().BeTrue(); _fakeRepository.Verify(x => x.GetAll(), Times.Once); _fakeRepository.Verify(x => x.Update(It.IsAny <HotelReservation>()), Times.Once); }
public void Deveria_adicioanar_uma_reserva_de_hotel_no_contexto() { //Arrange HotelReservation hotelReservation = HotelReservationBuilder.Start().Build(); hotelReservation.SetId(); foreach (var customer in hotelReservation.HotelReservationCustomers) { customer.SetId(); } //Action var hotelReservationAdd = _repository.Add(hotelReservation); //Assert var expectedHotelReservation = Context.HotelReservation.Find(hotelReservationAdd.Result.Id); expectedHotelReservation.Should().NotBeNull(); }
public void Deveria_excluir_reserva_de_voo_com_mais_de_10_dias() { var hotelReservation = HotelReservationBuilder.Start().WithInputDate(DateTime.Now.AddDays(12)).Build(); hotelReservation.CanDelete().Should().BeTrue(); }