public void CleanBadPhoneAddressTest() { OutputStreetAddress results = new OutputStreetAddress(); var b = _dataCleaner.VerifyAndCleanAddress(TestData.BadPhoneToClean, out results); Assert.IsFalse(b); Assert.IsFalse(results.OkPhone); }
public Boolean VerifyAndCleanAddress(InputStreetAddress inA, out OutputStreetAddress outA) { /* use settings from config file and process 1 record */ var iArray = new[] {inA}; var oArray = VerifyAndCleanAddress(iArray); outA = oArray[0]; return oArray[0].OkComplete; }
public void CleanCityAndPostalCodeAddressTest() { OutputStreetAddress results = new OutputStreetAddress(); var b = _dataCleaner.VerifyAndCleanAddress(TestData.BadCityAndPostalCodetoClean, out results); Assert.IsFalse(b); Assert.IsTrue(results.OkPhone); Assert.IsTrue(results.OkEmailAddress); Assert.IsFalse(results.OkMailingAddress); }
public void CleanBadStateAddressTest() { OutputStreetAddress results = new OutputStreetAddress(); var b = _dataCleaner.VerifyAndCleanAddress(TestData.MissingStateToClean, out results); Assert.IsTrue(b); Assert.IsTrue(results.OkPhone); Assert.IsTrue(results.OkEmailAddress); Assert.IsTrue(results.OkMailingAddress); }
public void CleanGoodAddressTest() { // clean an address and make sure the dataclean data is now OutputStreetAddress results = new OutputStreetAddress(); var b = _dataCleaner.VerifyAndCleanAddress(TestData.GoodAddresstoClean, out results); Assert.IsTrue(b); Assert.IsTrue(results.OkMailingAddress); Assert.IsTrue(results.OkComplete); Assert.IsTrue(results.OkPhone); Assert.IsTrue(results.OkEmailAddress); }
private List<DataCleanEvent> CombineOutputsAndInputs(List<InputStreetAddress> toBeCleaned,OutputStreetAddress[] outArray) { var convertedList = new List<DataCleanEvent>(); foreach (var i in toBeCleaned) { var e = new DataCleanEvent(); //find related output assign to local var var oc = outArray.First(obj => obj.RecordID == i.RecordID); if (oc != null) { e.DataCleanDate = DateTime.Now; e.Input = i; e.Output = oc; convertedList.Add(e); } } return convertedList; }
public static OutputStreetAddress ProcessResponseRecord(ResponseRecord respRec, ParseResultDictionary _msgDict ) { var o = new OutputStreetAddress() { AddressDeliveryInstallation = respRec.AddressDeliveryInstallation, AddressExtras = respRec.AddressExtras, AddressHouseNumber = respRec.AddressHouseNumber, AddressKey = respRec.AddressKey, AddressLine1 = respRec.AddressLine1, AddressLine2 = respRec.AddressLine2, AddressLockBox = respRec.AddressLockBox, AddressPostDirection = respRec.AddressPostDirection, AddressPreDirection = respRec.AddressPreDirection, AddressPrivateMailboxName = respRec.AddressPrivateMailboxName, AddressPrivateMailboxRange = respRec.AddressPrivateMailboxRange, AddressRouteService = respRec.AddressRouteService, AddressStreetName = respRec.AddressStreetName, AddressStreetSuffix = respRec.AddressStreetSuffix, AddressSuiteName = respRec.AddressSuiteName, AddressSuiteNumber = respRec.AddressSuiteNumber, AddressTypeCode = respRec.AddressTypeCode, AreaCode = respRec.AreaCode, CBSACode = respRec.CBSACode, CBSADivisionCode = respRec.CBSADivisionCode, CBSADivisionLevel = respRec.CBSADivisionLevel, CBSADivisionTitle = respRec.CBSADivisionTitle, CBSALevel = respRec.CBSALevel, CBSATitle = respRec.CBSATitle, CarrierRoute = respRec.CarrierRoute, CensusBlock = respRec.CensusBlock, CensusTract = respRec.CensusTract, City = respRec.City, CityAbbreviation = respRec.CityAbbreviation, CompanyName = respRec.CompanyName, CongressionalDistrict = respRec.CongressionalDistrict, CountryCode = respRec.CountryCode, CountryName = respRec.CountryName, CountyFIPS = respRec.CountyFIPS, CountyName = respRec.CountyName, DateOfBirth = respRec.DateOfBirth, DateOfDeath = respRec.DateOfDeath, DeliveryIndicator = respRec.DeliveryIndicator, DeliveryPointCheckDigit = respRec.DeliveryPointCheckDigit, DeliveryPointCode = respRec.DeliveryPointCode, DemographicsGender = respRec.DemographicsGender, DemographicsResults = respRec.DemographicsResults, DomainName = respRec.DomainName, EmailAddress = respRec.EmailAddress, Gender = respRec.Gender, Gender2 = respRec.Gender2, HouseholdIncome = respRec.HouseholdIncome, Latitude = respRec.Latitude, LengthOfResidence = respRec.LengthOfResidence, Longitude = respRec.Longitude, MailboxName = respRec.MailboxName, MaritalStatus = respRec.MaritalStatus, NameFirst = respRec.NameFirst, NameFirst2 = respRec.NameFirst2, NameFull = respRec.NameFull, NameLast = respRec.NameLast, NameLast2 = respRec.NameLast2, NameMiddle = respRec.NameMiddle, NameMiddle2 = respRec.NameMiddle2, NamePrefix = respRec.NamePrefix, NamePrefix2 = respRec.NamePrefix2, NameSuffix = respRec.NameSuffix, NameSuffix2 = respRec.NameSuffix2, NewAreaCode = respRec.NewAreaCode, Occupation = respRec.Occupation, OwnRent = respRec.OwnRent, PhoneExtension = respRec.PhoneExtension, PhoneNumber = respRec.PhoneNumber, PhonePrefix = respRec.PhonePrefix, PhoneSuffix = respRec.PhoneSuffix, PlaceCode = respRec.PlaceCode, PlaceName = respRec.PlaceName, Plus4 = respRec.Plus4, PostalCode = respRec.PostalCode, PresenceOfChildren = respRec.PresenceOfChildren, PrivateMailBox = respRec.PrivateMailBox, RecordExtras = respRec.RecordExtras, Results = _msgDict.LookupCodeList(respRec.Results.Split(',')).ToList(), Salutation = respRec.Salutation, State = respRec.State, StateName = respRec.StateName, Suite = respRec.Suite, TopLevelDomain = respRec.TopLevelDomain, UTC = respRec.UTC, UrbanizationName = respRec.UrbanizationName }; var i = SetIDS(respRec.RecordID); o.RecordID = i[0]; o.ID = (int) int.Parse(i[1]); return o; }
private static bool SetAddressOk(OutputStreetAddress outputStreetAddress) { if(outputStreetAddress.Errors.Count() != 0) return false; return true; }
protected OutputStreetAddress[] VerifyAndCleanAddressBatch(InputStreetAddress[] inputAddressArray) { Logger.Info(String.Format("Number of vouchers in batch to clean {0} ", inputAddressArray.Count())); if (inputAddressArray.Length > MaxArraySize) throw new Exception(String.Format("Too Many Items in Request maximum number is {0}", MaxArraySize)); _arraysize = inputAddressArray.Length; var rra = new RequestRecord[_arraysize]; var x = 0; foreach (var i in inputAddressArray) rra[x++] = new RequestRecord(i); _req.Records = rra; try { // the transmission results tell us if we got far enough to process records. if it is blank the answer is yes // if we got transmission results we have a broke - connection and or configuration _resp = _action.doContactVerify(_req); if (_resp.TransmissionResults.Trim() == "") { var o = new OutputStreetAddress[_resp.Records.Length]; int i = 0; foreach (var r in _resp.Records) { o[i++] = ResponseToOutputStreetAddressConverter.ProcessResponseRecord(r, _msgDict); } Logger.Info(String.Format("Number of vouchers cleaned {0} ", o.Count())); return o; } var t = GetTransmissionErrors(); string exText = null; foreach (var a in t) exText += a.ToString() + Environment.NewLine; throw new Exception(exText); } catch (Exception ex) { Logger.Error(ex.Message); throw; } }
public void CleanBadFirstNameTest() { OutputStreetAddress results = new OutputStreetAddress(); var b = _dataCleaner.VerifyAndCleanAddress(TestData.BadFirstNameToClean, out results); Assert.IsTrue(b); }