コード例 #1
0
ファイル: tstPayment.cs プロジェクト: Tech-E/Tech-E
        public void PaymentMethodMinPlusOne()
        {
            //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 = "Pa";
            //invoke the method 
            Ok = Apayment.Valid(SomePaymentMethod);
            //test to see that results is correct
            Assert.IsTrue(Ok);

        }
コード例 #2
0
ファイル: tstPayment.cs プロジェクト: Tech-E/Tech-E
 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);
 }
コード例 #3
0
ファイル: tstPayment.cs プロジェクト: Tech-E/Tech-E
        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);


        }
コード例 #4
0
ファイル: tstPayment.cs プロジェクト: Tech-E/Tech-E
 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);
 }
コード例 #5
0
ファイル: tstPayment.cs プロジェクト: Tech-E/Tech-E
        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);

        }