예제 #1
0
        public void removeProductSuccTest()
        {
            sr.addProduct(p);
            Assert.AreEqual("", sr1.removeProduct(p));

            Product returnP = DBProduct.getInstance().getProductByID(p.getProductID());

            Assert.AreEqual(returnP, null);
            Assert.AreEqual(store.getProductList().Contains(p), false);
        }
예제 #2
0
        public int addProduct(string productName, string productCategory, int price, int rank, int quantityLeft, int storeID, Session session)
        {
            DBStore   storeDB = DBStore.getInstance();
            Store     store   = storeDB.getStore(storeID);
            StoreRole sr      = store.getStoreRole(session.getSubscribedUser());
            Product   product = new Product(productName, productCategory, price, rank, quantityLeft, store);

            sr.addProduct(product);
            return(product.getProductID());
        }
예제 #3
0
        public void addProductSuccTest()
        {
            Assert.AreEqual("", sr.addProduct(p));

            Product returnP = DBProduct.getInstance().getProductByID(p.getProductID());

            Assert.AreEqual(returnP, p);
            Assert.AreEqual(store.getProductList().Contains(p), true);
        }
예제 #4
0
        public void addProductSuccTest()
        {
            try
            {
                sr.addProduct(p);

                Product returnP = DBProduct.getInstance().getProductByID(p.getProductID());

                Assert.AreEqual(returnP, p);
                Assert.AreEqual(store.getProductList().Contains(p), true);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }