public void GivenValidInput_WhenExecuteAsync_GatewayReceivesCorrectInputLength() { var lpi_key = "ABCDEFGHIJKLMN"; //14 characters _fakeGateway.Setup(s => s.GetSingleAddress("ABCDEFGHIJKLMN")).Returns(new Address()).Verifiable(); SetupValidatorToReturnValid(); var request = new GetAddressRequest { addressID = lpi_key }; _classUnderTest.ExecuteAsync(request); _fakeGateway.Verify(); }
public IActionResult GetAddress(string addressKey) { try { var request = new GetAddressRequest { addressID = addressKey }; var response = _getAddressUseCase.ExecuteAsync(request); if (response?.Address == null) { return(new NotFoundObjectResult(new ErrorResponse(404, new List <Error> { new Error("An address could not be found for the given key") }))); } return(new OkObjectResult(new APIResponse <GetAddressResponse>(response))); } catch (BadRequestException) { return(new BadRequestObjectResult(new ErrorResponse(400, new List <Error> { new Error("Address Key is invalid. It should by 14 characters long string.") }))); } }
public IActionResult GetAddress(string addressId) { var request = new GetAddressRequest { addressID = addressId }; var response = _getAddressUseCase.ExecuteAsync(request); return(HandleResponse(response)); }