public async Task SearchByUprn_GetPropertyAsync_ShouldReturnAddress() { var propertySearchResults = new searchForPropertyResponse() { FWTObjectBriefDetailsList = new List <FWTObjectBriefDetails> { new FWTObjectBriefDetails { ObjectID = new FWTObjectID { ObjectReference = new string[] { "test" } }, ObjectDescription = "test" } }.ToArray() }; _mockConnection .Setup(_ => _.Client().searchForPropertyAsync(It.Is <FWTPropertySearch>(_ => _.UPRN.Equals("100011489689")))) .ReturnsAsync(propertySearchResults); _mockConnection .Setup(_ => _.Client().retrievePropertyAsync(It.IsAny <FWTObjectID>())) .ReturnsAsync(new retrievePropertyResponse() { FWTProperty = new FWTProperty { UPRN = "Test", AddressLine1 = "Address 1" } }); var result = await _service.GetPropertyByUprnAsync("100011489689"); // Assert Assert.IsType <StockportGovUK.NetStandard.Models.Verint.Address>(result); Assert.NotNull(result); }
public async Task SearchByPostCode_GetPropertiesAsync_ShouldReturnListOfAddress() { var propertySearchResults = new searchForPropertyResponse() { FWTObjectBriefDetailsList = new List <FWTObjectBriefDetails> { new FWTObjectBriefDetails { ObjectID = new FWTObjectID { ObjectReference = new string[] { "test" } }, ObjectDescription = "test" } }.ToArray() }; _mockConnection .Setup(_ => _.Client().searchForPropertyAsync(It.Is <FWTPropertySearch>(_ => _.Postcode.Equals("sk2 5tl")))) .ReturnsAsync(propertySearchResults); _mockConnection .Setup(_ => _.Client().retrievePropertyAsync(It.IsAny <FWTObjectID>())) .ReturnsAsync(new retrievePropertyResponse() { FWTProperty = new FWTProperty { UPRN = "Test" } }); var result = await _service.GetPropertiesAsync("sk2 5tl"); // Assert Assert.IsType <List <StockportGovUK.NetStandard.Models.Verint.Address> >(result); }
public async Task SearchByPostCode_GetPropertiesAsync_ShouldReturnEmptyList() { var propertySearchResults = new searchForPropertyResponse() { FWTObjectBriefDetailsList = new List <FWTObjectBriefDetails>().ToArray() }; _mockConnection .Setup(_ => _.Client().searchForPropertyAsync(It.Is <FWTPropertySearch>(_ => _.Postcode.Equals("sk2 5tl")))) .ReturnsAsync(propertySearchResults); var result = await _service.GetPropertiesAsync("sk2 5tl"); // Assert Assert.Empty(result); }