Example #1
0
        public void TestCreate()
        {
            ProductProps p2 = (ProductProps)db.Create(testp);

            Assert.AreEqual(p2.ID, 17);
            Assert.AreEqual(p2.ConcurrencyID, 1);

            props = (ProductProps)db.Retrieve(17);
            Assert.AreEqual("XXXX", props.code);
            Assert.AreEqual(99.99, props.price);
        }
        public void TestCreate()
        {
            ProductSQLDB        db       = new ProductSQLDB(dataSource);
            ProductProps        p        = new ProductProps();
            List <ProductProps> propList = (List <ProductProps>)db.RetrieveAll(typeof(ProductProps));

            p.ID             = 800;
            p.description    = "Description";
            p.onhandquantity = 400;
            p.unitprice      = 515.25m;
            p.ConcurrencyID  = 1;

            Assert.AreEqual(16, propList.Count);

            ProductProps newProp = (ProductProps)db.Create(p);

            List <ProductProps> newList = (List <ProductProps>)db.RetrieveAll(typeof(ProductProps));

            Assert.AreEqual(17, newList.Count);
            Assert.AreEqual(52.50m, propList[9].unitprice);

            ProductProps anotherProp = (ProductProps)db.Create(newProp);
        }
Example #3
0
        public void TestDelete()
        {
            ProductSQLDB db    = new ProductSQLDB(dataSource);
            ProductProps props = new ProductProps();

            props.ProductCode    = "zzz       ";
            props.Description    = "zzz";
            props.UnitPrice      = 120.00m;
            props.OnHandQuantity = 1234;

            db.Create(props);

            ProductProps createdProduct = (ProductProps)db.Retrieve(props.ID);

            db.Delete(createdProduct);

            Assert.Throws <Exception>(() => db.Retrieve(props.ID));
        }
Example #4
0
        public void TestCreate()
        {
            ProductSQLDB db    = new ProductSQLDB(dataSource);
            ProductProps props = new ProductProps();

            props.ProductCode    = "zzz       ";
            props.Description    = "zzz";
            props.UnitPrice      = 120.00m;
            props.OnHandQuantity = 1234;

            db.Create(props);

            ProductProps createdProduct = (ProductProps)db.Retrieve(props.ID);

            Assert.AreEqual("zzz       ", createdProduct.ProductCode);
            Assert.AreEqual("zzz", createdProduct.Description);
            Assert.AreEqual(120.00m, createdProduct.UnitPrice);
            Assert.AreEqual(1234, createdProduct.OnHandQuantity);
        }
        public void TestCreateProduct()
        {
            ProductSQLDB db = new ProductSQLDB(dataSource);
            // declare and instantiate new ProductProps p
            ProductProps p = new ProductProps();

            p.prodCode       = "FS30";
            p.description    = "Murach's F# 2015";
            p.unitPrice      = 50.00M;
            p.onHandQuantity = 100;

            // Create record for p in the database
            db.Create(p);

            // Retrieve Product p from the database and store in variable pCreated
            ProductProps pCreated = (ProductProps)db.Retrieve(p.ID);

            Assert.AreEqual("FS30", pCreated.prodCode);
            Assert.AreEqual(100, pCreated.onHandQuantity);
        }