private static void CheckPolygonAreaNameIsDefined(GeographicalSearchResult result) { var areaName = result.PolygonAreaName; Assert.IsNotNull(areaName); Assert.AreNotEqual(0, areaName.Length); }
private static void CheckSerialisation(string propertyName, GeographicalSearchResult result) { JsonTestHelper.AssertPropertyIsSerialised(result, propertyName); JsonTestHelper.AssertPropertyIsNotSerialised(new GeographicalSearchResult(), propertyName); }
private static void CheckEastingAndNorthingAreNotDefined(GeographicalSearchResult result) { Assert.AreEqual(0, result.Easting); Assert.AreEqual(0, result.Northing); }
private GeographicalSearchResult NewGeographicalSearchResult(Document doc, int polygonAreaTypeId, bool isPostcode) { var name = GetName(isPostcode, doc); var geographicalSearchResult = new GeographicalSearchResult { PlaceName = name, County = _textInfo.ToTitleCase(doc.Get(FieldNames.County)), PolygonAreaCode = doc.Get("Parent_Area_Code_" + polygonAreaTypeId), PolygonAreaName = doc.Get("Parent_Area_Name_" + polygonAreaTypeId) }; return geographicalSearchResult; }
private void AssignEastingAndNorthing(Document doc, GeographicalSearchResult pp) { if (AreEastingAndNorthingRetrieved) { var easting = doc.Get(FieldNames.Easting); if (easting != null) { pp.Easting = int.Parse(easting); pp.Northing = int.Parse(doc.Get(FieldNames.Northing)); } } }
private static void CheckPolygonAreaCodeIsDefined(int childAreaTypeId, GeographicalSearchResult geographicalSearchResult) { if (geographicalSearchResult.PolygonAreaCode == null) { throw new FingertipsException(string.Format( "Area type id not supported for search: {0}", childAreaTypeId)); } }
private static void AddResultIfRequired(ResultsToInclude resultsToInclude, GeographicalSearchResult geographicalSearchResult, List<GeographicalSearchResult> searchResults) { bool addResult = true; switch (resultsToInclude) { case ResultsToInclude.ParentAreasOnly: addResult = geographicalSearchResult.AreCoordinatesValid() == false; break; case ResultsToInclude.PlaceNamesAndPostcodesOnly: addResult = geographicalSearchResult.AreCoordinatesValid(); break; } if (addResult) { searchResults.Add(geographicalSearchResult); } }