public void TestProcessReturnInReturnController() { //Create observer Observer ob1 = new Observer((string s, State status) => { }); //add transaction through the transaction controller TransactionController controller = new TransactionController(); controller.RegisterR(ob1); Tuple <int, int> productIDTransactionTyple = new Tuple <int, int>(1, 1); List <Tuple <int, int> > tuples = new List <Tuple <int, int> > { productIDTransactionTyple }; controller.CreateTransaction(tuples); //Create observer Observer ob = new Observer((string s, State status) => { Assert.AreEqual("Success! Items returned.", s); Assert.AreEqual(status, State.Return); }); //add transaction through the transaction controller ReturnController returnController = new ReturnController(); returnController.RegisterR(ob); returnController.ProcessReturn(1, 1, 1); }
public void TestAddToRebateList() { int transactionID = 1; String rebatesBefore = RebateDB.GenerateRebateChecks(); // Create Transaction int salesID = 1; int itemID = 1; int itemQuantity = 1; double itemCost = 2.29; // double rebatePercent = .05; // double totalRebate = itemQuantity * itemCost * rebatePercent; Product p1 = new Product("Diapers", itemID, itemCost); Tuple <Product, int> tuple1 = new Tuple <Product, int>(p1, itemQuantity); List <Tuple <Product, int> > items = new List <Tuple <Product, int> >(); Transaction t1 = new Transaction(salesID, items); TransactionDB.AddTransaction(t1); // create a rebates controller and try to access the transaction and then rebate it. However, error with Transactions so fails Observer ob = new Observer((string s, State status) => { Assert.AreNotEqual(rebatesBefore, s); Assert.AreEqual(status, State.Rebate); }); ReturnController controller = new ReturnController(); controller.RegisterR(ob); controller.ProcessReturn(1, 1, 1); }