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

            Assert.AreEqual(p.onHandQuantity, p2.onHandQuantity);
        }
        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);
        }
        /// <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);
        }
        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());
        }
        /// <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;
        }
        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;
        }
 public void TestDBRetrieve()
 {
     p2 = (ProductProps)db.Retrieve(1);
     Assert.AreEqual(p2.productCode.Trim(), "A4CS");
 }
        public void TestClone()
        {
            ProductProps newP = (ProductProps)p.Clone();

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