// 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 }
// 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 }