public async void Test_FlightController_PostAsync_ShouldBeOk() { var registerCommand = HotelReservationRegisterCommandBuilder.Start().Build(); _fakeMediator.Setup(mdtr => mdtr.Send(registerCommand, It.IsAny <CancellationToken>())) .ReturnsAsync(true); var callback = await _controller.CreateReservation(registerCommand); var response = callback.Should().BeOfType <OkResult>().Subject; }
public void PostHotelReservation_IntegrationTest() { //arrange var carCmd = HotelReservationRegisterCommandBuilder.Start().Build(); var myContent = JsonConvert.SerializeObject(carCmd); var stringContent = new StringContent(myContent, UnicodeEncoding.UTF8, "application/json"); //action var httpResponse = _client.PostAsync(_url, stringContent).Result; //assert httpResponse.EnsureSuccessStatusCode(); CustomWebApplicationFactory <Startup> .appDb.HotelReservation.Count().Should().Be(2); }
public async Task Deveria_criar_reserva_de_hotel_com_sucesso() { int expected = 1; HotelReservation reservation = HotelReservationBuilder.Start().Build(); var cmd = HotelReservationRegisterCommandBuilder.Start().Build(); _fakeMapper.Setup(x => x.Map <HotelReservation>(cmd)).Returns(reservation); var result = await _handler.Handle(cmd, It.IsAny <CancellationToken>()); result.Should().BeTrue(); _fakeRepository.Verify(x => x.Add(It.IsAny <HotelReservation>()), Times.Once); }
public void Deveria_editar_Reserva_Hotel_com_sucesso() { _hotelPage.HotelReservationViewButton.Click(); _hotelReservationPage = new HotelReservationPage(NgDriver); //action _hotelReservationPage.HotelReservationOpenButton.Click(); _hotelReservationFormPage.ClearData(); var command = HotelReservationRegisterCommandBuilder.Start().WithDescription("Atualizacao de reserva de voo").Build(); _hotelReservationFormPage.FillData(command); _hotelReservationFormPage.DefaultButtonsComponent.SaveButton.Click(); Thread.Sleep(1000); NgDriver.SwitchTo().Alert().Accept(); //assert NgDriver.Url.Should().Contain("/hotels"); }
public void Deveria_Salvar_Reserva_Hotel_com_sucesso() { //Arrange _hotelPage.HotelReservationCreateButton.Click(); var command = HotelReservationRegisterCommandBuilder.Start().Build(); _hotelReservationFormPage.FillData(command); //act _hotelReservationFormPage.DefaultButtonsComponent.SaveButton.Click(); Thread.Sleep(1000); NgDriver.SwitchTo().Alert().Accept(); //assert NgDriver.Url.Should().Contain("/hotels"); //_flightReservationPage.GenericGridComponent.HasAnyRow(2, command.Description).Should().BeTrue(); }