public void DeleteMethodOK()
        {
            clsCardsCollection AllCards = new clsCardsCollection();

            clsCard TestItem = new clsCard();

            double PrimaryKey = 0;

            TestItem.Active             = true;
            TestItem.CardNr             = 945345634563456;
            TestItem.CardHolder         = "Cezary Szwalbe";
            TestItem.CardSecurityNumber = 123;
            TestItem.ExpireDateYear     = DateTime.Now.Year;
            TestItem.ExpireDateMonth    = DateTime.Now.Month;

            AllCards.ThisCard = TestItem;
            PrimaryKey        = AllCards.Add();
            TestItem.CardNr   = PrimaryKey;
            AllCards.ThisCard.Find(PrimaryKey);
            AllCards.Delete();

            Boolean Found = AllCards.ThisCard.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
示例#2
0
        public void InstanceOK()
        {
            //create an instance of the class we want to create
            clsCard ACard = new clsCard();

            //test to see that it exists
            Assert.IsNotNull(ACard);
        }
示例#3
0
        public void CountPropertyOK()
        {
            //create an instance of the class we want to create
            clsCard ACard = new clsCard();
            //create some test data to assign to the property
            string CardHolder = "Cezary Szwalbe";

            //assign the data to the property
            ACard.CardHolder = CardHolder;
            //test to see that the values are the same
            Assert.AreEqual(ACard.CardHolder, CardHolder);
        }
        public void CardsListOK()
        {
            clsCardsCollection AllCards = new clsCardsCollection();
            List <clsCard>     TestList = new List <clsCard>();
            clsCard            TestItem = new clsCard();

            TestItem.Active             = true;
            TestItem.CardNr             = 945634563456345;
            TestItem.CardHolder         = "Cezary Szwalbe";
            TestItem.CardSecurityNumber = 123;
            TestItem.ExpireDateYear     = DateTime.Now.Year;
            TestItem.ExpireDateMonth    = DateTime.Now.Month;
            TestList.Add(TestItem);
            AllCards.CardsList = TestList;
            Assert.AreEqual(AllCards.CardsList, TestList);
        }
        public void ThisCardPropertyOK()
        {
            clsCardsCollection AllCards = new clsCardsCollection();

            clsCard TestItem = new clsCard();

            TestItem.Active             = true;
            TestItem.CardNr             = 9456345634563456;
            TestItem.CardHolder         = "Cezary Szwalbe";
            TestItem.CardSecurityNumber = 123;
            TestItem.ExpireDateYear     = DateTime.Now.Year;
            TestItem.ExpireDateMonth    = DateTime.Now.Month;

            AllCards.ThisCard = TestCard;

            Assert.AreEqual(AllCards.ThisCard, TestCard);
        }
示例#6
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, "");
        }
示例#7
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, "");
        }
示例#8
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, "");
        }
示例#9
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, "");
        }