Exemple #1
0
        public void should_throw_when_convert_invalid_phone_number(string countryCode, string number)
        {
            IPhoneNumber phoneNumber = new PhoneNumberImpl
            {
                CountryCode = countryCode,
                Number      = number
            };

            AssertHelper.Throws(
                () => PhoneNumberHelper.ToRegionE164PhoneNumber(phoneNumber));
        }
        public void should_throw_when_convert_invalid_phone_number(string countryCode, string number)
        {
            IPhoneNumber phoneNumber = new PhoneNumberImpl
            {
                CountryCode = countryCode,
                Number = number
            };

            AssertHelper.Throws(
                () => PhoneNumberHelper.ToRegionE164PhoneNumber(phoneNumber));            
        }
        public void should_get_success_when_phone_number_is_empty()
        {
            IPhoneNumber phoneNumber = new PhoneNumberImpl
            {
                CountryCode = "",
                Number = ""
            };
            PhoneNumberHelper.ToRegionE164PhoneNumber(phoneNumber);

            Assert.DoesNotThrow(() => PhoneNumberHelper.ToRegionE164PhoneNumber(phoneNumber));
            Assert.Equal(string.Empty, PhoneNumberHelper.ToRegionE164PhoneNumber(phoneNumber));
        }
Exemple #4
0
        public void should_get_empty_if_is_empty()
        {
            IPhoneNumber phoneNumber = new PhoneNumberImpl
            {
                CountryCode = "",
                Number      = ""
            };

            ValidationResult errorResult;

            Assert.Empty(PhoneNumberHelper.TryConvertToE164PhoneNumber(phoneNumber, out errorResult));
        }
Exemple #5
0
        public void should_get_number_if_is_legacy(string countryCode, string number)
        {
            IPhoneNumber phoneNumber = new PhoneNumberImpl
            {
                CountryCode = countryCode,
                Number      = number
            };

            ValidationResult errorResult;

            Assert.Equal(number, PhoneNumberHelper.TryConvertToE164PhoneNumber(phoneNumber, out errorResult));
        }
Exemple #6
0
        public void should_get_success_when_phone_number_is_empty()
        {
            IPhoneNumber phoneNumber = new PhoneNumberImpl
            {
                CountryCode = "",
                Number      = ""
            };

            PhoneNumberHelper.ToRegionE164PhoneNumber(phoneNumber);

            Assert.DoesNotThrow(() => PhoneNumberHelper.ToRegionE164PhoneNumber(phoneNumber));
            Assert.Equal(string.Empty, PhoneNumberHelper.ToRegionE164PhoneNumber(phoneNumber));
        }
Exemple #7
0
        public void should_get_e164_phone_nubmer_with_country_code()
        {
            IPhoneNumber phoneNumber = new PhoneNumberImpl
            {
                CountryCode = "CN",
                Number      = "13801231234"
            };

            ValidationResult errorResult;
            string           number = PhoneNumberHelper.TryConvertToE164PhoneNumber(phoneNumber, out errorResult);

            Assert.Equal("+8613801231234", number);
        }
        public void should_get_empty_if_is_empty()
        {
            IPhoneNumber phoneNumber = new PhoneNumberImpl
            {
                CountryCode = "",
                Number = ""
            };

            ValidationResult errorResult;

            Assert.Empty(PhoneNumberHelper.TryConvertToE164PhoneNumber(phoneNumber, out errorResult));
        }
        public void should_get_number_if_is_legacy(string countryCode, string number)
        {
            IPhoneNumber phoneNumber = new PhoneNumberImpl
            {
                CountryCode = countryCode,
                Number = number
            };

            ValidationResult errorResult;
            Assert.Equal(number, PhoneNumberHelper.TryConvertToE164PhoneNumber(phoneNumber, out errorResult));
        }
        public void should_get_e164_phone_nubmer_with_country_code()
        {
            IPhoneNumber phoneNumber = new PhoneNumberImpl
            {
                CountryCode = "CN",
                Number = "13801231234"
            };

            ValidationResult errorResult;
            string number = PhoneNumberHelper.TryConvertToE164PhoneNumber(phoneNumber, out errorResult);

            Assert.Equal("+8613801231234", number);
        }