public void InstanceOk() { //create an instance of the payment class clsPayment Apayment = new clsPayment(); //test to see that exists Assert.IsNotNull(Apayment); }
public clsPaymentCollection() { //var for the index Int32 Index = 0; //var to store the record count Int32 RecordCount = 0; //object for the data connection clsDataConnection DB = new clsDataConnection(); //execute the stored procedure DB.Execute("sproc_tblPayment_SelectAll"); //get the count of records RecordCount = DB.Count; //while there are records to proccess while (Index < RecordCount) { //create a blank customer clsPayment APayment = new clsPayment(); // //read in the fields from the current record APayment.PaymentNo = Convert.ToInt32(DB.DataTable.Rows[Index]["PaymentNo"]); APayment.PaymentMethod = Convert.ToString(DB.DataTable.Rows[Index]["PaymentMethod"]); APayment.Amount = Convert.ToDecimal(DB.DataTable.Rows[Index]["Amount"]); APayment.Dateadded = Convert.ToDateTime(DB.DataTable.Rows[Index]["DateAdded"]); // //add the record to the private data member paymentList.Add(APayment); // //point at the next record Index++; } }
public void PaymentMethod() { //create an instance of the paymentmethod clsPayment Apayment = new clsPayment(); //create some test data to assign to the property string SomePaymentMethod = "Paypal"; //assign the data to the property Apayment.PaymentMethod = SomePaymentMethod; //test to see that the two values are the same Assert.AreEqual(Apayment.PaymentMethod, SomePaymentMethod); }
public void PaymentMethodMaxLessOne() { //create an instance of the paymentmethod clsPayment Apayment = new clsPayment(); //boolean variable to store the results of the validation Boolean Ok = false; //some string test data to assign the property string SomePaymentMethod = "Paypa"; //invoke the method Ok = Apayment.Valid(SomePaymentMethod); //test to see that results is correct Assert.IsTrue(Ok); }
public void PaymentListAndCountOK() { //create an instance of the class that we want to create clsPaymentCollection AllPayments = new clsPaymentCollection(); //create sometest data to assign to the property List<clsPayment> TestList = new List<clsPayment>(); //add an itm to the list //create the item of test data clsPayment TestItem = new clsPayment(); //set the properties TestItem.PaymentNo = 1; TestItem.PaymentMethod = "PAYPAL"; TestItem.Amount = 50; TestItem.Dateadded = DateTime.Now; //add the item to the test list TestList.Add(TestItem); //assign the data to the property AllPayments.PaymentList = TestList; //test to see that the two values are the same Assert.AreEqual(AllPayments.Count, TestList.Count); }
public void DateAddedInvalidData() { //create an instance of the paymentmethod clsPayment Apayment = new clsPayment(); //boolean variable to store the result of the validation Boolean OK = false; //create some test data to pass to the method string PaymentNo = "25"; string Amount = "69.99"; string PaymentMethod = "Debit Card"; //set data added to a non value string DateAdded = "19/07/4000"; //invoke the method OK = Apayment.Valid(PaymentNo, Amount, PaymentMethod, DateAdded); //test to see that result is correct Assert.IsTrue(OK); }
public void DateAddedExtremeMax() { //create an instance of the paymentmethod clsPayment Apayment = new clsPayment(); //boolean variable to store the result of the validation Boolean OK = false; //create some test data to pass to the method string PaymentNo = "25"; string Amount = "69.99"; string PaymentMethod = "Debit Card"; //create a variable to store the test date data DateTime TestDate; //set todays date TestDate = DateTime.Now.Date; //change the date to whatever the date is less 100 years TestDate = TestDate.AddYears(100); //convert the date to a string variable string DateAdded = TestDate.ToString(); //invoke the method OK = Apayment.Valid(PaymentNo, Amount, PaymentMethod, DateAdded); //test to see that result is correct Assert.IsTrue(OK); }
public void PaymentNoExtremeMax() { //create an instance of the paymentmethod clsPayment Apayment = new clsPayment(); //boolean variable to store the result of the validation Boolean OK = false; //create some test data to pass to the method string PaymentNo = ""; //this should fail PaymentNo = PaymentNo.PadRight(1, 'q'); string Amount = "69.99"; string PaymentMethod = "Debit Card"; string DateAdded = DateTime.Now.Date.ToString(); //invoke the method OK = Apayment.Valid(PaymentNo, Amount, PaymentMethod, DateAdded); //test to see that result is correct Assert.IsTrue(OK); }
public void FindMethodOk() { //create an instance of the paymentmethod clsPayment Apayment = new clsPayment(); //boolean variable to store the result of the validation Boolean Found = false; //create some test data to use with the method Int32 PaymentNo = 2; //invoke the method Found = Apayment.Find(PaymentNo); //test to see that the result is correct Assert.IsTrue(Found); }
public void Amount() { //create an instance of the paymentmethod clsPayment Apayment = new clsPayment(); //create some test data assign to the property Int32 TestData = 200; //assign the data to the property Apayment.Amount = TestData; //test to see that the two values are the same Assert.AreEqual(Apayment.Amount, TestData); }
public void PaymentDate() { //create an instance of the paymentmethod clsPayment Apayment = new clsPayment(); //create some test data to assign to the property DateTime TestData = DateTime.Now.Date; //assign the data to the property Apayment.Dateadded = TestData; Assert.AreEqual(Apayment.Dateadded, TestData); }
public void PaymentMethodExtremeMax() { //create an instance of the paymentmethod clsPayment Apayment = new clsPayment(); //boolean variable to store the results of the validation Boolean Ok = false; //some string test data to assign the property string SomePaymentMethod = ""; //pad the string with a characters SomePaymentMethod = SomePaymentMethod.PadRight(23, 'p'); //invoke the method Ok = Apayment.Valid(SomePaymentMethod); //test to see that results is correct Assert.IsFalse(Ok); }