public static PostalAddressFileEntry FromKeyStringDictionary(KeyStringDictionary data) { if (null == data) { return(null); } var result = new PostalAddressFileEntry { Address = { SubBuildingName = TryString(data, "SBN"), PostOfficeBox = TryString(data, "POB"), BuildingName = TryString(data, "BNA"), BuildingNumber = TryString(data, "NUM"), DependentStreet = TryString(data, "DST"), MainStreet = TryString(data, "STM"), DoubleDependentLocality = TryString(data, "DDL"), DependentLocality = TryString(data, "DLO"), PostTown = TryString(data, "PTN"), AdministrativeCounty = TryString(data, "CTA"), FormerPostalCounty = TryString(data, "CTP"), TraditionalCounty = TryString(data, "CTT"), Postcode = TryString(data, "PCD") }, Organization = { Department = TryString(data, "ORD"), Name = TryString(data, "ORC") }, Category = data.ContainsKey("CAT") && !string.IsNullOrEmpty(data["CAT"]) ? UserCategory.Resolve(data["CAT"][0]) : null, DeliveryPointSuffix = TryString(data, "DPX"), MultipleOccupancyCount = TryInt32(data, "MOC"), MultipleResidencyRecordCount = TryInt32(data, "MRC"), NumberOfDeliveryPoints = TryInt32(data, "NDP"), Origin = data.ContainsKey("DTO") && !string.IsNullOrEmpty(data["DTO"]) ? data["DTO"][0] : new char?(), SortCode = TryInt32(data, "SCD"), UniqueMultipleResidenceReferenceNumber = TryInt32(data, "UMR"), UniqueDeliveryPointReferenceNumber = TryInt32(data, "URN"), }; return(result); }
private static int?TryInt32(KeyStringDictionary data, string key) { if (!data.ContainsKey(key)) { return(new int?()); } return(string.IsNullOrEmpty(data[key]) ? new int?() : data.TryValue <int>(key)); }
public static PostalAddressFileEntry FromKeyStringDictionary(KeyStringDictionary data) { if (null == data) { return null; } var result = new PostalAddressFileEntry { Address = { SubBuildingName = TryString(data, "SBN"), PostOfficeBox = TryString(data, "POB"), BuildingName = TryString(data, "BNA"), BuildingNumber = TryString(data, "NUM"), DependentStreet = TryString(data, "DST"), MainStreet = TryString(data, "STM"), DoubleDependentLocality = TryString(data, "DDL"), DependentLocality = TryString(data, "DLO"), PostTown = TryString(data, "PTN"), AdministrativeCounty = TryString(data, "CTA"), FormerPostalCounty = TryString(data, "CTP"), TraditionalCounty = TryString(data, "CTT"), Postcode = TryString(data, "PCD") }, Organization = { Department = TryString(data, "ORD"), Name = TryString(data, "ORC") }, Category = data.ContainsKey("CAT") && !string.IsNullOrEmpty(data["CAT"]) ? UserCategory.Resolve(data["CAT"][0]) : null, DeliveryPointSuffix = TryString(data, "DPX"), MultipleOccupancyCount = TryInt32(data, "MOC"), MultipleResidencyRecordCount = TryInt32(data, "MRC"), NumberOfDeliveryPoints = TryInt32(data, "NDP"), Origin = data.ContainsKey("DTO") && !string.IsNullOrEmpty(data["DTO"]) ? data["DTO"][0] : new char?(), SortCode = TryInt32(data, "SCD"), UniqueMultipleResidenceReferenceNumber = TryInt32(data, "UMR"), UniqueDeliveryPointReferenceNumber = TryInt32(data, "URN"), }; return result; }
private static int? TryInt32(KeyStringDictionary data, string key) { if (!data.ContainsKey(key)) { return new int?(); } return string.IsNullOrEmpty(data[key]) ? new int?() : data.TryValue<int>(key); }
public void op_CopyTo_KeyStringDictionary() { var obj = new KeyStringDictionary { new KeyStringPair("key", "value") }; var copy = new KeyStringDictionary(); obj.CopyTo(copy); Assert.True(copy.ContainsKey("key")); Assert.False(copy.ContainsKey("example")); }
public void op_ContainsKey_string() { var obj = new KeyStringDictionary { new KeyStringPair("key", "value") }; Assert.True(obj.ContainsKey("key")); Assert.False(obj.ContainsKey("example")); }
public void op_CloneOfT_whenKeyStringDictionary() { var obj = new KeyStringDictionary { new KeyStringPair("key", "value") }; var clone = obj.Clone<KeyStringDictionary>(); Assert.NotNull(clone); Assert.True(obj.ContainsKey("key")); Assert.False(obj.ContainsKey("example")); }