public async Task <StockportGovUK.NetStandard.Models.Verint.Address> GetPropertyAsync(string id) { var propertySearch = new FWTObjectID { ObjectReference = new[] { id }, ObjectType = VerintConstants.PropertyObjectType }; var result = await _verintConnection.retrievePropertyAsync(propertySearch); var address = new StockportGovUK.NetStandard.Models.Verint.Address { UPRN = result.FWTProperty.UPRN?.Trim(), AddressLine1 = result.FWTProperty.AddressLine1?.Trim(), AddressLine2 = result.FWTProperty.AddressLine2?.Trim(), City = result.FWTProperty.City?.Trim(), Postcode = result.FWTProperty.Postcode?.Trim(), Number = result.FWTProperty.AddressNumber?.Trim(), USRN = result.FWTProperty.USRN?.Trim(), Easting = result.FWTProperty.GPSItmGeoCode?.Trim(), Northing = result.FWTProperty.GPSUtmGeoCode?.Trim() }; return(address); }
public void ToCase_ShouldMapToCase_WhenMapUsed_PavementJourney() { // Arrange var request = new FloodingRequest { WhereIsTheFlood = "pavement", WhereIsTheFloodingComingFrom = "river", WhatDoYouWantToReport = "flood", Map = new Map { Lat = "lat", Lng = "lng", Street = "street, place, 123456" }, Reporter = new ContactDetails { FirstName = "FirstName", LastName = "LastName", PhoneNumber = "PhoneNumber", EmailAddress = "EmailAddress" }, HowWouldYouLikeToBeContacted = "phone", IsTheFloodingBlockingTheWholePavementOrCausing = "yes", TellUsABoutTheFlood = "It's a flood" }; var streetResult = new FloodingAddress { UniqueId = "654321", USRN = "123456", Name = "street, place" }; var addressResult = new StockportGovUK.NetStandard.Models.Verint.Address { USRN = "123456", Reference = "reference", Description = "description" }; var expectedDescription = "Where is the flood coming from: river\r\nWhere is the flood: On a pavement\r\nBlocking the pavement: yes\r\nTell us about the flood: It's a flood\r\nHow would you like to be contacted: phone\r\n"; // Act var result = request.ToCase(_floodingPavementConfiguration, streetResult, _pavementFloodingLocationConfiguration); // Assert Assert.Equal(2002592, result.EventCode); Assert.Equal(_floodingPavementConfiguration.VerintOption.Classification, result.Classification); Assert.Equal(_floodingPavementConfiguration.VerintOption.EventTitle, result.EventTitle); Assert.Equal(streetResult.Name, result.Street.Description); Assert.Equal(streetResult.USRN, result.Street.USRN); Assert.Equal(streetResult.UniqueId, result.Street.Reference); Assert.Equal(expectedDescription, result.Description); }
public async Task <StockportGovUK.NetStandard.Models.Verint.Address> GetPropertyByUprnAsync(string uprn) { var fwtPropertySearch = new FWTPropertySearch { UPRN = uprn }; var propertySearchResults = await _verintConnection.searchForPropertyAsync(fwtPropertySearch); if (propertySearchResults == null || !propertySearchResults.FWTObjectBriefDetailsList.Any()) { return(null); } var fWTObjectID = new FWTObjectID { ObjectReference = new[] { propertySearchResults.FWTObjectBriefDetailsList.FirstOrDefault().ObjectID.ObjectReference[0] }, ObjectType = VerintConstants.PropertyObjectType }; var result = await _verintConnection.retrievePropertyAsync(fWTObjectID); var address = new StockportGovUK.NetStandard.Models.Verint.Address { UPRN = result.FWTProperty.UPRN?.Trim(), Description = propertySearchResults.FWTObjectBriefDetailsList.FirstOrDefault().ObjectDescription?.Trim(), AddressLine1 = result.FWTProperty.AddressLine1?.Trim(), AddressLine2 = result.FWTProperty.AddressLine2?.Trim(), City = result.FWTProperty.City?.Trim(), Postcode = result.FWTProperty.Postcode?.Trim(), Number = result.FWTProperty.AddressNumber?.Trim(), USRN = result.FWTProperty.USRN?.Trim(), Easting = result.FWTProperty.GPSItmGeoCode?.Trim(), Northing = result.FWTProperty.GPSUtmGeoCode?.Trim() }; return(address); }
public async Task <string> CheckUPRNForId(StockportGovUK.NetStandard.Models.Verint.Address address) { // HACK: Check whether UPRN provided is actually an ID and if so lookup the real UPRN // If it's a real ID it shouldn't return a property! if (!string.IsNullOrEmpty(address.UPRN)) { try { var propertyResult = await GetPropertyAsync(address.UPRN); if (propertyResult != null) { return(propertyResult.UPRN); } } catch (Exception ex) { _logger.LogWarning($"PropertyService.CheckUPRNForId - Exception occurred searching for property, assuming UPRN {address.UPRN}", ex); } } return(address.UPRN); }