public async Task ShouldAbleToSubmitCreditorData() { // Arrange var creditorAddress = new Address { AddressLine1 = "AddressLine1", AddressLine2 = "AddressLine2", TownCity = "TownCity", County = "County", Postcode = "Postcode" }; var expected = Guid.NewGuid(); _mockApiClient .Setup(s => s.CreateAsync <Guid, CustomAddress>( It.IsAny <CustomAddress>(), It.IsAny <string>()) ) .Returns(Task.FromResult(expected)); // Act var result = await _integrationGateway.AddAdHocCreditorAddressAsync(creditorAddress, expected); // Asserts Assert.AreEqual(expected, result); }
public async Task <IActionResult> CreditorPostcodeSave(AddressSearchViewModel model) { if (!ModelState.IsValid || !HttpContext.Session.Keys.Contains(_newCreditorId)) { SetJourneyObject(model); SetAdHocCreditorNameToViewBag(); var storedModel = GetJourneyObject <AddressSearchViewModel>(nameof(CreditorPostcode)); model.Addresses = storedModel.Addresses; return(ContinueJourneyRedirect(nameof(CreditorPostcode), new { debtId = model.DebtId, hasError = true })); } var creditorId = new Guid(HttpContext.Session.GetString(_newCreditorId)); var address = await _addressLookupService.GetFullAddressAsync(model.SelectedAddress); await _integrationGateway.AddAdHocCreditorAddressAsync(address, creditorId); SetJourneyObject(model); return(ContinueJourneyRedirect(nameof(DebtSold), new { id = creditorId })); }