public void DeletePaymentMethodOK() { //Create an instance of the class we want to create clsSTPaymentCollection AllPayments = new clsSTPaymentCollection(); //Create an item of test data clsSTPayment PaymentTestItem = new clsSTPayment(); //Var to store the primary key Int32 PrimaryKey = 0; //Set its properties PaymentTestItem.CardNumber = "1234567891234567"; PaymentTestItem.AccountNumber = "12345678"; PaymentTestItem.SortCode = "123456"; PaymentTestItem.ExpiryDate = "12/22"; PaymentTestItem.ValidFrom = "12/19"; PaymentTestItem.CardHolderName = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM"; PaymentTestItem.CVC = "123"; //Set this ThisPayment to the test data AllPayments.ThisPayment = PaymentTestItem; //Add the record PrimaryKey = AllPayments.Add(); //Set the primary key of the test data PaymentTestItem.PaymentID = PrimaryKey; //search the payment record AllPayments.ThisPayment.Find(PrimaryKey); //Delete the record AllPayments.Delete(); //Now found the payment record Boolean Found = AllPayments.ThisPayment.Find(PrimaryKey); //test to see that the two values are the same Assert.IsFalse(Found); }
public void ListPaymentAndCountOK() { //Create an instance of the class we want to create clsSTPaymentCollection AllTestPayments = new clsSTPaymentCollection(); //Create some test data to assign to the property //in this case the data needs to be a list of objects List <clsSTPayment> PaymentTestList = new List <clsSTPayment>(); //Add an item to the list clsSTPayment PaymentTestItem = new clsSTPayment(); //Set it properties PaymentTestItem.CardNumber = "1234567891234567"; PaymentTestItem.AccountNumber = "12345678"; PaymentTestItem.SortCode = "123456"; PaymentTestItem.ExpiryDate = "12/22"; PaymentTestItem.ValidFrom = "12/19"; PaymentTestItem.CardHolderName = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM"; PaymentTestItem.CVC = "123"; //Add the test payment item to the list PaymentTestList.Add(PaymentTestItem); //Assign the data to the property AllTestPayments.PaymentList = PaymentTestList; //Test to see that the two values are the same Assert.AreEqual(AllTestPayments.Count, PaymentTestList.Count); }
void Update() { //Create an instance of the payment book clsSTPaymentCollection PaymentBook = new clsSTPaymentCollection(); //Validate the data on the web form string Error = PaymentBook.ThisPayment.Valid(TextBoxCardNumber.Text, TextBoxAccountNumber.Text, TextBoxSortCode.Text, TextBoxExpiryDate.Text, TextBoxValidFrom.Text, TextBoxCardHolderName.Text, TextBoxCVC.Text); //If the data is ok then add it to the object if (Error == "") { //Find the payment id record to update PaymentBook.ThisPayment.Find(PaymentID); //Get the data entered by the user PaymentBook.ThisPayment.CardNumber = TextBoxCardNumber.Text; PaymentBook.ThisPayment.AccountNumber = TextBoxAccountNumber.Text; PaymentBook.ThisPayment.SortCode = TextBoxSortCode.Text; PaymentBook.ThisPayment.ExpiryDate = TextBoxExpiryDate.Text; PaymentBook.ThisPayment.ValidFrom = TextBoxValidFrom.Text; PaymentBook.ThisPayment.CardHolderName = TextBoxCardHolderName.Text; PaymentBook.ThisPayment.CVC = TextBoxCVC.Text; //Update the payment record PaymentBook.Update(); //All done so redirect to the home payment page Response.Redirect("Payment.aspx"); } else { //Report an error LableError.Text = "There was a problem with the payment method you tried updating" + Error; } }
public void InstanceOK() { //Create an instance of the class we want to create clsSTPaymentCollection AllTestPayments = new clsSTPaymentCollection(); //Test to see if that it exists Assert.IsNotNull(AllTestPayments); }
void DeletePayments() { //Create a new instance of the payment book clsSTPaymentCollection PaymentBook = new clsSTPaymentCollection(); //Find the record to delete PaymentBook.ThisPayment.Find(PaymentID); //Delete the record PaymentBook.Delete(); }
void DisplaySelectedPayments() { //Create an instance of the payment book clsSTPaymentCollection PaymentBook = new clsSTPaymentCollection(); //Find the record to update PaymentBook.ThisPayment.Find(PaymentID); //Display the data for the record wanting to be updated TextBoxCardNumber.Text = PaymentBook.ThisPayment.CardNumber; TextBoxAccountNumber.Text = PaymentBook.ThisPayment.AccountNumber; TextBoxSortCode.Text = PaymentBook.ThisPayment.SortCode; TextBoxExpiryDate.Text = PaymentBook.ThisPayment.ExpiryDate; TextBoxValidFrom.Text = PaymentBook.ThisPayment.ValidFrom; TextBoxCardHolderName.Text = PaymentBook.ThisPayment.CardHolderName; TextBoxCVC.Text = PaymentBook.ThisPayment.CVC; }
public void UpdatePaymentMethodOK() { //Create an instance of the class we want to create clsSTPaymentCollection AllPayments = new clsSTPaymentCollection(); //Create an item of test data clsSTPayment PaymentTestItem = new clsSTPayment(); //Var to store the primary key Int32 PrimaryKey = 0; //Set its properties PaymentTestItem.CardNumber = "1234567891234567"; PaymentTestItem.AccountNumber = "12345678"; PaymentTestItem.SortCode = "123456"; PaymentTestItem.ExpiryDate = "12/22"; PaymentTestItem.ValidFrom = "12/19"; PaymentTestItem.CardHolderName = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM"; PaymentTestItem.CVC = "123"; //Set this ThisPayment to the test data AllPayments.ThisPayment = PaymentTestItem; //Add the payment record PrimaryKey = AllPayments.Add(); //Set the primary key of the test data PaymentTestItem.PaymentID = PrimaryKey; //Modify the test data PaymentTestItem.CardNumber = "1234567891234568"; PaymentTestItem.AccountNumber = "12345679"; PaymentTestItem.SortCode = "123457"; PaymentTestItem.ExpiryDate = "12/23"; PaymentTestItem.ValidFrom = "12/20"; PaymentTestItem.CardHolderName = "I HATE PROJECT MANAGEMENT"; PaymentTestItem.CVC = "124"; //Set the record based on the new test data AllPayments.ThisPayment = PaymentTestItem; //Update the record AllPayments.Update(); //Find the record AllPayments.ThisPayment.Find(PrimaryKey); //test to see that the two values are the same Assert.AreEqual(AllPayments.ThisPayment, PaymentTestItem); }