public void CovertFromNumericToAlpha2()
        {
            string result = CountryUtils.GetCountryCodeByCountry("826", CountryCodeFormat.Alpha2);

            Assert.IsNotNull(result);
            Assert.AreEqual("GB", result);
        }
Beispiel #2
0
        public void GetNumericCodeByCountryName()
        {
            string result = CountryUtils.GetNumericCodeByCountry("United States of America");

            Assert.IsNotNull(result);
            Assert.AreEqual("840", result);
        }
        public void CovertFromAlpha2ToAlpha3()
        {
            string result = CountryUtils.GetCountryCodeByCountry("GB", CountryCodeFormat.Alpha3);

            Assert.IsNotNull(result);
            Assert.AreEqual("GBR", result);
        }
        public void CovertFromAlpha3ToNumeric()
        {
            string result = CountryUtils.GetCountryCodeByCountry("GBR", CountryCodeFormat.Numeric);

            Assert.IsNotNull(result);
            Assert.AreEqual("826", result);
        }
        public void GetCountryCodeAlpha3WithMisspelled()
        {
            string result = CountryUtils.GetCountryCodeByCountry("Afganistan", CountryCodeFormat.Alpha3);

            Assert.IsNotNull(result);
            Assert.AreEqual("AFG", result);
        }
        public void CovertFromCountryNametoAlpha2()
        {
            string result = CountryUtils.GetCountryCodeByCountry("United Kingdom of Great Britain and Northern Ireland", CountryCodeFormat.Alpha2);

            Assert.IsNotNull(result);
            Assert.AreEqual("GB", result);
        }
        public void GetNetherlandsAntillesCountryCodeByCountryName()
        {
            string result = CountryUtils.GetCountryCodeByCountry("Netherlands Antilles");

            Assert.IsNotNull(result);
            Assert.AreEqual("AN", result);
        }
        public void GetNetherlandsAntillesNumericCodeByCountryCode()
        {
            string result = CountryUtils.GetNumericCodeByCountry("AN");

            Assert.IsNotNull(result);
            Assert.AreEqual("530", result);
        }
        public void GetCountryCodeByExactNumericCodeAndCountryCodeFormat()
        {
            string result = CountryUtils.GetCountryCodeByCountry("364", CountryCodeFormat.Numeric);

            Assert.IsNotNull(result);
            Assert.AreEqual("364", result);
        }
Beispiel #10
0
        public void GetNumericCodeByNumericCode()
        {
            string result = CountryUtils.GetNumericCodeByCountry("840");

            Assert.IsNotNull(result);
            Assert.AreEqual("840", result);
        }
Beispiel #11
0
        public void GetCountryByThreeDigitCode()
        {
            string result = CountryUtils.GetCountryByCode("USA");

            Assert.IsNotNull(result);
            Assert.AreEqual("United States of America", result);
        }
        public void GetCountryCodeAlpha3FromPartial()
        {
            string result = CountryUtils.GetCountryCodeByCountry("Republic of Congo", CountryCodeFormat.Alpha3);

            Assert.IsNotNull(result);
            Assert.AreEqual("COD", result);
        }
Beispiel #13
0
        public void GetCountryCodeByExactCode()
        {
            string result = CountryUtils.GetCountryCodeByCountry("IE");

            Assert.IsNotNull(result);
            Assert.AreEqual("IE", result);
        }
Beispiel #14
0
        public void GetCountryByCodeExact()
        {
            string result = CountryUtils.GetCountryByCode("IE");

            Assert.IsNotNull(result);
            Assert.AreEqual("Ireland", result);
        }
Beispiel #15
0
        public void GetCountryCodeByPartialCode()
        {
            string result = CountryUtils.GetCountryCodeByCountry("USA");

            Assert.IsNotNull(result);
            Assert.AreEqual("US", result);
        }
Beispiel #16
0
        public void GetCountryCodeMisspelled()
        {
            string result = CountryUtils.GetCountryCodeByCountry("Afganistan");

            Assert.IsNotNull(result);
            Assert.AreEqual("AF", result);
        }
Beispiel #17
0
        public void GetCountryCodeFromPartial()
        {
            string result = CountryUtils.GetCountryCodeByCountry("Republic of Congo");

            Assert.IsNotNull(result);
            Assert.AreEqual("CD", result);
        }
Beispiel #18
0
 public PaymentViewModel()
 {
     Title                  = "Payment";
     SelectedCountry        = CountryUtils.GetCountryModelByName("Sweden");
     ShowPopupCommand       = new Command(async _ => await ExecuteShowPopupCommand());
     CountrySelectedCommand = new Command(country => ExecuteCountrySelectedCommand(country as CountryModel));
 }
 public AboutViewModel()
 {
     Title                  = "About";
     SelectedCountry        = CountryUtils.GetCountryModelByName("United States");
     ShowPopupCommand       = new Command(async _ => await ExecuteShowPopupCommand());
     CountrySelectedCommand = new Command(country => ExecuteCountrySelectedCommand(country as CountryModel));
 }
        public void GetCountryCodeByMispelledCode()
        {
            string result = CountryUtils.GetCountryByCode("VNN");

            Assert.IsNotNull(result);
            Assert.AreEqual("Vietnam", result);
        }
Beispiel #21
0
 protected override void Merge(Country source, Country target)
 {
     CountryUtils.Merge(source, target);
 }
Beispiel #22
0
        public void GetCountryCodeFakeCountry3()
        {
            string result = CountryUtils.GetCountryCodeByCountry("MyRussia");

            Assert.IsNull(result);
        }
Beispiel #23
0
        public void GetCountryCodeFakeCountry2()
        {
            string result = CountryUtils.GetCountryCodeByCountry("Fakeistan");

            Assert.IsNull(result);
        }
Beispiel #24
0
 public void GetCountryCodeNullDoesNotError()
 {
     CountryUtils.GetCountryCodeByCountry(null);
 }
Beispiel #25
0
 public bool IsCountry(string countryCode)
 {
     return(CountryUtils.IsCountry(this, countryCode));
 }
        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);
        }
Beispiel #27
0
 protected override QueryFilters <CountryProperty> GetChanges(Country original, Country changed)
 {
     return(CountryUtils.GetChanges(original, changed));
 }
Beispiel #28
0
        public void GetNumericCodeByNonExistingCountryName()
        {
            string result = CountryUtils.GetNumericCodeByCountry("Fake Country Name");

            Assert.IsNull(result);
        }