public static void Data(APIsOptions aPIsOptions, ValidationResult validation, List <string> states, string correctStateCode, List <string> zipCodes = null) { switch (aPIsOptions) { case APIsOptions.SmartyStreets: WriteLine("-----------SMARTY STREETS API-----------"); break; case APIsOptions.Radar: WriteLine("-----------RADAR API-----------"); break; case APIsOptions.OpenCage: WriteLine("-----------OPENCAGE API-----------"); break; case APIsOptions.LocationlQ: WriteLine("-----------LOCATIONLQ API-----------"); break; case APIsOptions.HERE: WriteLine("-----------HERE API-----------"); break; } if (validation.IsValid == true && states.Count > 1) { states.ForEach(state => WriteLine($"States: {state}")); WriteLine($"Validation:{validation.IsValid}"); WriteLine($"Accuracy:{validation.Accuracy}"); } if (validation.IsValid == true && states.Count == 1) { states.ForEach(state => WriteLine($"State: {state}")); } if (validation.IsValid == false) { WriteLine($"Validation:{validation.IsValid}"); WriteLine($"Accuracy:{validation.Accuracy}"); } WriteLine($"Correct state code:{correctStateCode}"); WriteLine($"Are matched: {states.Contains(correctStateCode)}"); }
public override IStreetLookUp FactoryMethod(APIsOptions option) { switch (option) { case APIsOptions.Radar: return(new RadarAPIFactory()); case APIsOptions.SmartyStreets: return(new SmartyStreetsAPIFactory()); default: throw new ArgumentException("Invalid type", "type"); } }
public static void Write(APIsOptions options, Dictionary <AddressCorrectness, Statistics> results, StreamWriter writer, CsvWriter csvWriter) { csvWriter.WriteField($"{ options}-Correct addresses result"); csvWriter.NextRecord(); csvWriter.WriteField($"Matched:{results[AddressCorrectness.Correct].NumberOfMatched} of 70 results"); csvWriter.WriteField($"Precentege:{Math.Round(results[AddressCorrectness.Correct].PercentageOfMatched,2)}"); csvWriter.NextRecord(); csvWriter.WriteField($"{ options}-Incorrect addresses result"); csvWriter.NextRecord(); csvWriter.WriteField($"Matched:{results[AddressCorrectness.Incorrect].NumberOfMatched} of 30 results"); csvWriter.WriteField($"Precentege:{Math.Round(results[AddressCorrectness.Incorrect].PercentageOfMatched, 2)}"); csvWriter.NextRecord(); writer.Flush(); }
public static IStreetLookUp Create(APIsOptions option) { switch (option) { case APIsOptions.Radar: return(new RadarAPIStreetLookup()); case APIsOptions.SmartyStreets: return(new SmartyStreetsAPILookup()); case APIsOptions.OpenCage: return(new OpenCageStreetLookup()); case APIsOptions.LocationlQ: return(new LocationlQStreetLookup()); case APIsOptions.HERE: return(new HEREAPIStreetLookup()); default: throw new ArgumentException("Invalid type", "type"); } }
public abstract IStreetLookUp FactoryMethod(APIsOptions type);