コード例 #1
0
        public void Should_Validate_Against_A_List_Of_Numbers()
        {
            ICreditCardNumberCheck sut = SuT;

            foreach (var entry in NetworkToCreditCardNumberSamples)
            {
                Assert.IsTrue(sut.IsValid(entry.Value, entry.Key));
            }
        }
コード例 #2
0
        public void Should_Validate_Against_A_List_Of_Numbers_Automatically()
        {
            ICreditCardNumberCheck sut = SuT;

            foreach (var entry in NetworkToCreditCardNumberSamples)
            {
                try
                {
                    Assert.IsTrue(sut.IsValid(entry.Value, CreditCardNetwork.Automatic));
                }
                catch (ArgumentException exc)
                {
                    throw new ArgumentException(entry.Value, exc);
                }
            }
        }
コード例 #3
0
 static CreditCardNumberExtensions()
 {
     creditCardNumberCheck = new CreditCardNumberCheck();
 }
コード例 #4
0
        public void Should_Calculate_A_Digit_With_Visa()
        {
            ICreditCardNumberCheck sut = SuT;

            Assert.AreEqual("6", sut.CalculateCheckDigit("4992739871", CreditCardNetwork.Visa));
        }
コード例 #5
0
        public void Should_Validate_An_Account_Number_With_Automatic()
        {
            ICreditCardNumberCheck sut = SuT;

            Assert.IsTrue(sut.IsValid("4556-3371-6490-1361", CreditCardNetwork.Automatic));
        }
コード例 #6
0
        public void Should_Validate_An_Account_Number_With_Non_Digits_With_Method_Visa()
        {
            ICreditCardNumberCheck sut = SuT;

            Assert.IsTrue(sut.IsValid("0499-2739-8710-0006", CreditCardNetwork.Visa));
        }
コード例 #7
0
        public void Should_Validate_An_Account_Number_With_Method_Visa_To_False()
        {
            ICreditCardNumberCheck sut = SuT;

            Assert.IsFalse(sut.IsValid("0499273987100007", CreditCardNetwork.Visa));
        }