// use the following method for invoke from VisualStudio UnitTesting TestTools
        public Boolean test(SalesItems[] item)
        {
            try
            {
                CalculateTax caltx = new CalculateTax(item);
                SalesReceipt sr    = new SalesReceipt(caltx);

                Console.WriteLine();
                sr.PrintItemswithTax();
                sr.PrintTotalSalesTax();
                sr.PrintTotal();
                Console.WriteLine();
            }
            catch (ArgumentNullException e)        // If the argument is null, throw ArgumentNullException and fail the test case
            {
                Console.WriteLine("ArgumentNullException {0}", e.Message);
                return(false);  //fail the test case
            }

            return(true); // Pass the test case
        }
Esempio n. 2
0
        // use the following method for invoke from VisualStudio UnitTesting TestTools
        public Boolean test(SalesItems[] item)
        {
            try
            {
                CalculateTax caltx = new CalculateTax(item);
                SalesReceipt sr = new SalesReceipt(caltx);

                Console.WriteLine();
                sr.PrintItemswithTax();
                sr.PrintTotalSalesTax();
                sr.PrintTotal();
                Console.WriteLine();
            }
            catch (ArgumentNullException e)        // If the argument is null, throw ArgumentNullException and fail the test case
            {
                Console.WriteLine("ArgumentNullException {0}", e.Message);
                return false;  //fail the test case
            }

            return true; // Pass the test case
        }
Esempio n. 3
0
 // init the CalculateTax and calculate the tax amounts
 public SalesReceipt(CalculateTax ct)
 {
     caltax = ct;
     h = caltax.CaluculateToalTaxItemAmount();
 }
Esempio n. 4
0
 // init the CalculateTax and calculate the tax amounts
 public SalesReceipt(CalculateTax ct)
 {
     caltax = ct;
     h      = caltax.CaluculateToalTaxItemAmount();
 }