Beispiel #1
0
 public void TestGetProduct()
 {
     Product p = ProductDB.GetProduct("2JST      ");
     Assert.AreEqual("2JST      ", p.ProductCode);
     Assert.AreEqual(6937, p.OnHandQuantity);
 }
Beispiel #2
0
 public void UpdateProduct()
 {
     Assert.True(ProductDB.UpdateProduct(this.testProduct, this.testProduct2));
     Assert.True(ProductDB.UpdateProduct(this.testProduct2, this.testProduct));
 }
Beispiel #3
0
 public void InsertProduct()
 {
     Assert.True(ProductDB.AddProduct(this.testProduct));
 }
Beispiel #4
0
 public void DeleteProduct()
 {
     Assert.True(ProductDB.DeleteProduct(this.testProduct));
 }
Beispiel #5
0
        public void TestUpdateProduct()
        {
            //need to retrieve product from data base
            //either use clone or can use two variables
            //update values to change except for the ProductCode
            //Because ProductCode is what references the actual product and knows what to update.

            Product p = new Product();

            p.ProductCode    = "ZZZ1";
            p.Description    = "Test Product";
            p.UnitPrice      = 99.9M;
            p.OnHandQuantity = 2;
            ProductDB.DeleteProduct(p);
            ProductDB.AddProduct(p);



            Product op = ProductDB.GetProduct("ZZZ1     ");
            Product np = ProductDB.GetProduct("ZZZ1     ");

            Assert.AreEqual(2, op.OnHandQuantity);
            Assert.AreEqual(2, np.OnHandQuantity);


            np.OnHandQuantity = 3;


            ProductDB.UpdateProduct(op, np);
            Product pp = ProductDB.GetProduct("ZZZ1     ");



            Assert.AreEqual(3, pp.OnHandQuantity);

            //np.Description = "Replaced Test Product";
            //np.UnitPrice = 00.0M;
            //np.OnHandQuantity = 3;

            //ProductDB.UpdateProduct(op, np);

            //Assert.AreEqual(3, op.OnHandQuantity);



            // My previous thoughts when I wasn't getting the product and expecting the
            // method to change the values.

            //Product op = new Product();
            //op.ProductCode = "ZZZZ";
            //op.Description = "Test Product";
            //op.UnitPrice = 99.9M;
            //op.OnHandQuantity = 2;

            //Product np = new Product();
            //np.ProductCode = "YYYY";
            //np.Description = "Replaced Test Product";
            //np.UnitPrice = 00.0M;
            //np.OnHandQuantity = 3;


            //ProductDB.UpdateProduct(op, np);

            //Trying to test that the Product op was switched to the np values.
            //Does not appear to be working this way.

            // Assert.AreEqual("YYYY      ", op.ProductCode);
        }
Beispiel #6
0
        public void TestGetProduct()
        {
            Product p = ProductDB.GetProduct("XYZ1");

            Assert.IsTrue(p != null);
        }