Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void TestGenerateChecks()
        {
            String rebateString = RebateDB.GenerateRebateChecks();

            Observer ob = new Observer((string s, State status) => { Assert.AreEqual(s, rebateString); Assert.AreEqual(State.Generate, status); });
            GenerateChecksController controller = new GenerateChecksController();

            controller.RegisterGCC(ob);
            controller.GenerateChecks();
        }
Ejemplo n.º 3
0
        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;
            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);

            // Add transaction to rebate list
            Observer         ob         = new Observer((string s, State status) => { Assert.AreNotEqual(rebatesBefore, s); Assert.AreEqual(status, State.Rebate); });
            RebateController controller = new RebateController();

            controller.RegisterRC(ob);
            controller.AddToRebateList(Convert.ToDateTime("06/02/2018"), transactionID);
        }
 /// <summary>
 /// Generates the rebate checks.
 /// </summary>
 /// <param name="percent">percentage of the discount</param>
 /// <param name="Date">date of rebate submission</param>
 /// <returns></returns>
 public void GenerateChecks() // may want to hard code the rebate percent;
 {
     status    = State.Generate;
     returnval = RebateDB.GenerateRebateChecks();
     update(returnval, status);
 }
        public void AssertNoRebatesAtProgramStart()
        {
            String rebates = RebateDB.GenerateRebateChecks();

            Assert.AreEqual("There are no checks to Generate", rebates);
        }