public void GetCountryByThreeDigitCode() { string result = CountryUtils.GetCountryByCode("USA"); Assert.IsNotNull(result); Assert.AreEqual("United States of America", result); }
public void GetCountryByCodeExact() { string result = CountryUtils.GetCountryByCode("IE"); Assert.IsNotNull(result); Assert.AreEqual("Ireland", result); }
public void GetCountryCodeByMispelledCode() { string result = CountryUtils.GetCountryByCode("VNN"); Assert.IsNotNull(result); Assert.AreEqual("Vietnam", result); }
public static string Convert(TLSecureValue secureValue) { var personalDetails = secureValue.Type as TLSecureValueTypePersonalDetails; if (personalDetails != null) { var rootObject = secureValue.Data.DecryptedData as PersonalDetailsRootObject; if (rootObject != null) { return(rootObject.ToString( GenderToStringConverter.Convert, x => { var country = CountryUtils.GetCountryByCode(x); return country != null ? country.Name : null; })); } } var passport = secureValue.Type as TLSecureValueTypePassport; if (passport != null) { if (secureValue.Data.DecryptedData != null) { return(secureValue.Data.DecryptedData.ToString()); } } var driverLicence = secureValue.Type as TLSecureValueTypeDriverLicense; if (driverLicence != null) { if (secureValue.Data.DecryptedData != null) { return(secureValue.Data.DecryptedData.ToString()); } } var identityCard = secureValue.Type as TLSecureValueTypeIdentityCard; if (identityCard != null) { if (secureValue.Data.DecryptedData != null) { return(secureValue.Data.DecryptedData.ToString()); } } var internalPassport = secureValue.Type as TLSecureValueTypeInternalPassport; if (internalPassport != null) { if (secureValue.Data.DecryptedData != null) { return(secureValue.Data.DecryptedData.ToString()); } } var address = secureValue.Type as TLSecureValueTypeAddress; if (address != null) { var rootObject = secureValue.Data.DecryptedData as ResidentialAddressRootObject; if (rootObject != null) { return(rootObject.ToString(x => { var country = CountryUtils.GetCountryByCode(x); return country != null ? country.Name : null; })); } } var utilityBill = secureValue.Type as TLSecureValueTypeUtilityBill; if (utilityBill != null) { return(AppResources.PassportDocuments); } var bankStatement = secureValue.Type as TLSecureValueTypeBankStatement; if (bankStatement != null) { return(AppResources.PassportDocuments); } var rentalAgreement = secureValue.Type as TLSecureValueTypeRentalAgreement; if (rentalAgreement != null) { return(AppResources.PassportDocuments); } var passportRegistration = secureValue.Type as TLSecureValueTypePassportRegistration; if (passportRegistration != null) { return(AppResources.PassportDocuments); } var temporaryRegistration = secureValue.Type as TLSecureValueTypeTemporaryRegistration; if (temporaryRegistration != null) { return(AppResources.PassportDocuments); } var phone = secureValue.Type as TLSecureValueTypePhone; if (phone != null) { var plainData = secureValue.PlainData as TLSecurePlainPhone; if (plainData != null && !TLString.IsNullOrEmpty(plainData.Phone)) { return(plainData.Phone.ToString().StartsWith("+") ? plainData.Phone.ToString() : "+" + plainData.Phone); } } var email = secureValue.Type as TLSecureValueTypeEmail; if (email != null) { var plainData = secureValue.PlainData as TLSecurePlainEmail; if (plainData != null && !TLString.IsNullOrEmpty(plainData.Email)) { return(plainData.Email.ToString()); } } return(null); }