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); }
int Add() { clsCardsCollection CardBook = new clsCardsCollection(); String Error = CardBook.ThisCard.Valid(txtCardNumber.Text, txtCardHolder.Text, txtsecuritycode.Text, txtYear.Text, txtMonth.Text); if (Error == "") { CardBook.ThisCard.Active = true; CardBook.ThisCard.CardHolder = txtCardHolder.Text; CardBook.ThisCard.CardNr = Int64.Parse(txtCardNumber.Text); CardBook.ThisCard.ExpireDateMonth = Int32.Parse(txtMonth.Text); CardBook.ThisCard.ExpireDateYear = Int32.Parse(txtYear.Text); CardBook.ThisCard.CardSecurityNumber = Int32.Parse(txtsecuritycode.Text); CardBook.Add(); Response.Redirect("Payment_Details.aspx"); return(1); } else { lblError.Text = "There were problems with data entered" + Error; return(0); } }