Example #1
0
        public void TestDBCreate()
        {
            db.Create(p);
            ProductProps p2 = (ProductProps)db.Retrieve(p.productID);

            Assert.AreEqual(p.onHandQuantity, p2.onHandQuantity);
        }
Example #2
0
        public void TestSetState1()
        {
            ProductProps newP = new ProductProps();
            string       xml  = p.GetState();

            newP.SetState(xml);
            Assert.AreEqual(p.productID, newP.productID);
            Assert.AreEqual(p.description, newP.description);
        }
Example #3
0
        /// <summary>
        /// Clones this object.
        /// </summary>
        /// <returns>A clone of this object.</returns>
        public object Clone()
        {
            ProductProps p = new ProductProps();

            p.productID      = this.productID;
            p.productCode    = this.productCode;
            p.description    = this.description;
            p.unitPrice      = this.unitPrice;
            p.onHandQuantity = this.onHandQuantity;
            p.ConcurrencyID  = this.ConcurrencyID;
            return(p);
        }
Example #4
0
        public void TestUpdate()
        {
            Product p = new Product(3, dataSource);

            p.ProductCode = "TEST";
            p.Description = "Test Product";
            p.Save();

            p = new Product(3, dataSource);
            Assert.AreEqual(p.ProductCode, "TEST".Trim());
            Assert.AreEqual(p.Description, "Test Product".Trim());
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="xml"></param>
        public void SetState(string xml)
        {
            XmlSerializer serializer = new XmlSerializer(this.GetType());
            StringReader  reader     = new StringReader(xml);
            ProductProps  p          = (ProductProps)serializer.Deserialize(reader);

            this.productID      = p.productID;
            this.productCode    = p.productCode;
            this.description    = p.description;
            this.unitPrice      = p.unitPrice;
            this.onHandQuantity = p.onHandQuantity;
            this.ConcurrencyID  = p.ConcurrencyID;
        }
Example #6
0
        public void Setup()
        {
            db = new ProductDB(dataSource);
            p  = new ProductProps();

            DBCommand command = new DBCommand();

            command.CommandText = "usp_testingResetData";
            command.CommandType = CommandType.StoredProcedure;
            db.RunNonQueryProcedure(command);

            p.productID      = 100;
            p.productCode    = "xxx";
            p.description    = "my test product";
            p.onHandQuantity = 2;
            p.unitPrice      = 99;
        }
Example #7
0
 public void TestDBRetrieve()
 {
     p2 = (ProductProps)db.Retrieve(1);
     Assert.AreEqual(p2.productCode.Trim(), "A4CS");
 }
Example #8
0
        public void TestClone()
        {
            ProductProps newP = (ProductProps)p.Clone();

            Assert.AreEqual(newP.GetState(), p.GetState());
        }
Example #9
0
 public void TestDDBelete()
 {
     p = (ProductProps)db.Retrieve(2);
     Assert.True(db.Delete(p));
 }
Example #10
0
 public void TestDBUpdate()
 {
     p             = (ProductProps)db.Retrieve(1);
     p.description = "I like thanksgiving.";
     Assert.True(db.Update(p));
 }