private void ValidateLocationExistsInCounty(string county, string location) { var soapClient = new UKLocationSoapClient(); var returnValue = soapClient.GetUKLocationByCounty(county); XmlDocument doc = new XmlDocument(); doc.LoadXml(returnValue); var outputNode = doc.SelectSingleNode(".//Table/Town[text() = '" + location + "']"); if (outputNode == null) { throw new Exception(string.Format("Expected Location : {0} not found in County {1}", location, county)); } var postcode = doc.SelectSingleNode(".//Table/Town[text() = '" + location + "']/following-sibling::PostCode"); Console.WriteLine("Location {0} with PostCode {1} found in the County {2}", location, postcode.InnerText, county); }
private void ValidateLocationExistsInCounty(string county, string location) { var soapClient = new UKLocationSoapClient(); var returnValue = soapClient.GetUKLocationByCounty(county); XmlDocument doc = new XmlDocument(); doc.LoadXml(returnValue); var outputNode = doc.SelectSingleNode(".//Table/Town[text() = '" + location + "']"); if (outputNode == null) { throw new Exception(string.Format("Expected Location : {0} not found in County {1}", location, county)); } var postcode = doc.SelectSingleNode(".//Table/Town[text() = '" + location + "']/following-sibling::PostCode"); Console.WriteLine("Location {0} with PostCode {1} found in the County {2}", location, postcode.InnerText, county); }