private async Task VerifyResult(Business.Dtos.Charge newCharge, ActivityDto activityDto, ChargeActivityServiceApiClient clientActivityService, ChargeResponse result) { result.Should().BeOfType <ChargeResponseOK>(); await clientActivityService.Received(1).NotifyNewCharge(Arg.Is <ActivityDto>(item => item.identifier == activityDto.identifier)); await clientChargeRepository.Received(1).AddCharge(newCharge); await clientActivityService.Received(1).UpdateNotifyCharge(Arg.Is <ActivityDto>(item => item.identifier == activityDto.identifier && item.AddResult == activityDto.AddResult)); }
public async Task given_data_for_add_new_charge_we_obtein_a_ok_response_with_true_result() { ReturnValueForPostAsync(false); string requestUri = "http://localhost:10001/api/charges/add"; Charge newCharge = GivenACharge(); var content = GivenAHttpContent(newCharge, requestUri); var chargeRepositoryServiceClient = new ChargeRepositoryServiceApiClient(client); ChargeResponse result = await chargeRepositoryServiceClient.AddCharge(newCharge); result.Should().BeOfType <Charges.Business.Dtos.ChargeResponseOK>(); result.alreadyExist.Should().Be(false); result.Message.Should().BeNull(); await client.Received(1).PostAsync(Arg.Any <string>(), Arg.Any <HttpContent>()); }