public void TestDelete()
        {
            ProductSQLDB db    = new ProductSQLDB(dataSource);
            ProductProps props = (ProductProps)db.Retrieve(8);

            Assert.AreEqual(8, props.ID);
            db.Delete(props);
            var x = Assert.Throws <Exception>(() => db.Retrieve(8));

            Assert.That(x.Message == "Record does not exist in the database.");
        }
        public void TestDeleteProduct()
        {
            ProductSQLDB db    = new ProductSQLDB(dataSource);
            ProductProps props = (ProductProps)db.Retrieve(14);

            //14    SQ12    Murach's SQL Server 2012     57.50   2465

            // delete ProductProps props from the database
            db.Delete(props);

            // attempting to retrieve props from the database should result in exception throw
            Assert.Throws <Exception>(() => db.Retrieve(14));
        }
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));
        }