コード例 #1
0
        public void CardHolderMinBoundary()
        {
            //create an instance of the class we want to create
            clsCard ACard = new clsCard();
            //create a string variable to store the result of the validation
            String Error = "";
            //create some test data to test the method
            string CardNr             = "1234132413241324";
            string CardHolder         = "CezaryS";
            string CardSecurityNumber = "123";
            string ExpireDateYear     = "2020";
            string ExpireDateMonth    = "11";

            //invoke the method
            Error = ACard.Valid(CardNr, CardHolder, CardSecurityNumber, ExpireDateYear, ExpireDateMonth);
            //test to see that the result is OK i.e there was no error message returned
            Assert.AreEqual(Error, "");
        }
コード例 #2
0
        public void CardNumberNoExtremeMin()
        {
            //create an instance of the class we want to create
            clsCard ACard = new clsCard();
            //string variable to store the error message
            string Error              = "";
            string CardHolder         = "Cezary AAAAA";
            string CardSecurityNumber = "123";
            string ExpireDateYear     = "2020";
            string ExpireDateMonth    = "11";
            //create some test data to pass to the method
            string CardNr = "8"; //this should pass

            //invoke the method
            Error = ACard.Valid(CardNr, CardHolder, CardSecurityNumber, ExpireDateYear, ExpireDateMonth);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
コード例 #3
0
        public void CardHolderMinLessOne()
        {
            //create an instance of the class we want to create
            clsCard ACard = new clsCard();
            //create a string variable to store the result of the validation
            String Error = "";
            //create some test data to test the method
            string CardNr             = "0123456789012345";
            string CardHolder         = "Cezary";
            string CardSecurityNumber = "123";
            string ExpireDateYear     = "2020";
            string ExpireDateMonth    = "11";

            //invoke the method
            Error = ACard.Valid(CardNr, CardHolder, CardSecurityNumber, ExpireDateYear, ExpireDateMonth);
            //test to see that the result is NOT OK i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }
コード例 #4
0
        public void CardHolderEtremeMax()
        {
            //create an instance of the class we want to create
            clsCard ACard = new clsCard();
            //create a string variable to store the result of the validation
            String Error = "";
            //create some test data to test the method
            string CardHolder = "";

            //pad the string with characters
            CardHolder = CardHolder.PadRight(500, 'a');

            string CardSecurityNumber = "123";
            string ExpireDateYear     = "2020";
            string ExpireDateMonth    = "11";
            string CardNr             = "1234132413241324";

            //invoke the method
            Error = ACard.Valid(CardNr, CardHolder, CardSecurityNumber, ExpireDateYear, ExpireDateMonth);
            //test to see that the result is NOT OK i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }