public override bool IsValid(InputTypes type)
        {
            if (type == InputTypes.Username || type == InputTypes.Password)
            {
                return(base.IsValid(type));
            }
            Regex re = new Regex(InputTypeValue.Value(type));

            switch (type)
            {
            case InputTypes.FirstName:
                return(re.IsMatch(user.GetFirstName()));

            case InputTypes.LastName:
                return(re.IsMatch(user.GetLastName()));

            case InputTypes.Email:
                return(RegexUtilities.IsValidEmail(user.GetEmail()));

            case InputTypes.FullAddress:
                return(AddressAPI.IsAddressValid(user));

            default:
                return(false);
            }
        }
示例#2
0
        public void CityStateLookupError()
        {
            ZipCode zip = new() { Zip5 = "7220" };

            zip = AddressAPI.LookupCityState(zip);

            Assert.IsNotNull(zip.Error);
        }
示例#3
0
        public async Task CityStateLookupError()
        {
            ZipCode zip = new() { Zip5 = "7220" };

            zip = await AddressAPI.LookupCityStateAsync(zip);

            Assert.IsNotNull(zip.Error);
        }
示例#4
0
        public void CityStateLookup()
        {
            ZipCode zip = new() { Zip5 = "72201" };

            zip = AddressAPI.LookupCityState(zip);

            Assert.IsTrue(!String.IsNullOrEmpty(zip.City));
            Assert.IsTrue(!String.IsNullOrEmpty(zip.State));
        }
示例#5
0
        public async Task CityStateLookup()
        {
            ZipCode zip = new() { Zip5 = "72201" };

            zip = await AddressAPI.LookupCityStateAsync(zip);

            Assert.IsTrue(!String.IsNullOrEmpty(zip.City));
            Assert.IsTrue(!String.IsNullOrEmpty(zip.State));
        }
示例#6
0
        public void ZipLookup()
        {
            Address addr = new()
            {
                Address1 = "500 woodlane street",
                City     = "little rock",
                State    = "arkansas"
            };

            addr = AddressAPI.LookupZipCode(addr);

            Assert.IsTrue(!String.IsNullOrEmpty(addr.Zip5));
        }
示例#7
0
        public async Task ValidateAddress()
        {
            string  add1 = "500 woodlane street";
            Address addr = new()
            {
                Address1 = add1,
                City     = "little rock",
                State    = "arkansas",
                Zip5     = "72201"
            };

            addr = await AddressAPI.ValidateAddressAsync(addr);

            Assert.IsTrue(add1 != addr.Address1);
        }
示例#8
0
        public void ValidateAddress()
        {
            string  add1 = "500 woodlan stret";
            Address addr = new()
            {
                Address1 = add1,
                City     = "litle rock",
                State    = "arkansas",
                Zip5     = "72201"
            };

            addr = AddressAPI.ValidateAddress(addr);

            Assert.IsTrue(add1 != addr.Address1);
        }