public void TestInvalidDelete() { ProductProps props = (ProductProps)db.Retrieve(16); props.ConcurrencyID += 1; Assert.Throws <Exception>(() => db.Delete(props)); }
public void TestRetrieve() { ProductSQLDB db = new ProductSQLDB(dataSource); ProductProps props = (ProductProps)db.Retrieve(2); Assert.AreEqual(2, props.ID); }
public void TestClone() { ProductProps props2 = (ProductProps)props1.Clone(); Assert.NotNull(props2); Assert.AreNotSame(props1, props2); }
public void TestDelete() { ProductProps props = (ProductProps)db.Retrieve(1); db.Delete(props); Assert.Throws <Exception>(() => db.Retrieve(1)); }
public Product(ProductProps props, string cnString) : base(props, cnString) { mConnectionString = cnString; SetUp(); LoadProps(props); }
} //end of Retrieve() public object RetrieveAll(Type type) { List <ProductProps> list = new List <ProductProps>(); DBDataReader reader = null; ProductProps props; try { reader = RunProcedure("usp_ProductSelectAll"); if (!reader.IsClosed) { while (reader.Read()) { props = new ProductProps(); props.SetState(reader); list.Add(props); } } return(list); } catch (Exception e) { // log this exception throw e; } finally { if (!reader.IsClosed) { reader.Close(); } } }
public void DeleteInvalidConcurrencyIDTest() { ProductProps props = (ProductProps)db.Create(newProps); props.ConcurrencyID++; Assert.Throws <Exception>(() => db.Delete(props)); }
public void CreateProduct() { try { Console.WriteLine("PRODUCT NAME:"); string Name = Console.ReadLine(); Console.WriteLine("Description:"); string Description = Console.ReadLine(); Console.WriteLine("Price:"); int Price = Convert.ToInt32(Console.ReadLine()); IProductProps props = new ProductProps(); props.name = Name; props.price = Price; props.description = Description; props.id = Generator.getId("product"); this.Products.AddItem(this.factory.create(props)); } catch { this.CreateProduct(); } }
public void TestRetrieve() { props = (ProductProps)db.Retrieve(1); Assert.AreEqual("A4CS", props.code); Assert.AreEqual(56.50, props.price); //assert all }
public void TestCreateProduct() { ProductProps p2 = (ProductProps)DB.Create(p); ProductProps p3 = (ProductProps)DB.Retrieve(p2.ID); Assert.True(p3.code.Trim() == p.code.Trim()); }
public void TestCreate() { pdb.Create(p); ProductProps createdP = (ProductProps)pdb.Retrieve(p.productID); Assert.AreEqual(createdP.productCode, p.productCode); }
public void WriteListOfProps() { List <ProductProps> products = new List <ProductProps>(); ProductProps props = new ProductProps(); props.id = 1; props.code = "P100"; props.onHandQty = 10; props.unitPrice = 100m; props.description = "This is the description of the first event"; products.Add(props); props = new ProductProps(); props.id = 2; props.code = "P200"; props.onHandQty = 20; props.unitPrice = 200m; props.description = "This is the description of the second event"; products.Add(props); XmlSerializer serializer = new XmlSerializer(products.GetType()); Stream writer = new FileStream(folder + "products.xml", FileMode.Create); serializer.Serialize(writer, products); writer.Close(); }
public void TestPropAndStringConstructor() { ProductSQLDB db = new ProductSQLDB(dataSource); ProductProps props = (ProductProps)db.Retrieve(1); Product c = new Product(props, dataSource); Assert.AreEqual("A4CS ", c.ProductCode); }
public void TestProductTextDBDelete() { ProductTextDB db = new ProductTextDB(folder); ProductProps props = (ProductProps)db.Retrieve(1); db.Delete(props); Assert.Throws <Exception>(() => db.Retrieve(1)); }
public void TestProductTextDBRetrieve() { ProductTextDB db = new ProductTextDB(folder); ProductProps props = (ProductProps)db.Retrieve(1); Assert.AreEqual("P100", props.code); Assert.AreEqual(10, props.onHandQuantity); }
public void TestPropsRetrieve() { ProductDB db = new ProductDB(dataSource); ProductProps props = (ProductProps)db.Retrieve(2); Assert.AreEqual(props.productID, 2); Console.WriteLine(props.GetState()); }
public void TestInvalidUpdate() { ProductProps props = (ProductProps)db.Retrieve(16); Console.WriteLine(props.productCode.Trim()); props.productCode = "AM27"; props.ConcurrencyID += 1; Assert.Throws <Exception>(() => db.Update(props)); }
public void TestRetrieve() { //fix for product db ProductProps props = (ProductProps)db.Retrieve(1); Assert.AreEqual(56.50m, props.unitPrice); Assert.AreEqual(4637, props.onHandQuantity); Assert.AreEqual("A4CS", props.productCode); }
public void DeleteTest() { ProductProps props = (ProductProps)db.Create(newProps); int id = props.ID; Assert.IsTrue(db.Delete(props)); Assert.Throws <Exception>(() => db.Retrieve(id)); Assert.Throws <Exception>(() => db.Delete(props)); }
public void TestDelete() { ProductProps props = (ProductProps)db.Retrieve(16); db.Delete(props); List <ProductProps> propsList = (List <ProductProps>)db.RetrieveAll(db.GetType()); Assert.AreEqual(15, propsList.Count); }
public void TestRetrieve() { ProductProps props = (ProductProps)db.Retrieve(1); Assert.AreEqual(props.productCode.Trim(), "A4CS"); Assert.AreEqual(props.description, "Murach's ASP.NET 4 Web Programming with C# 2010"); Assert.AreEqual(props.unitPrice, 56.50); Assert.AreEqual(props.onHandQuantity, 4637); }
public void TestProductTextDBRetrieve() { ProductSQLDB db = new ProductSQLDB(DataSource); ProductProps props = (ProductProps)db.Retrieve(1); Assert.AreEqual(1, props.id); Assert.AreEqual("A4CS", props.code); Assert.AreEqual(4637, props.onHandQty); }
public void SetUpTests() { p = new ProductProps(); p.ID = 10; p.Code = "p000"; p.Description = "This is a test"; p.Quantity = 10; p.ConcurrencyID = 1; }
public void TestClone() { ProductProps props2 = (ProductProps)props1.Clone(); Assert.NotNull(props2); props1.ProductCode = "zzzz"; Assert.AreNotEqual(props2.ProductCode, props1.ProductCode); Assert.AreNotSame(props2, props1); }
public void TestSetStateXML() { ProductProps newP = new ProductProps(); string xml = p.GetState(); newP.SetState(xml); Assert.AreEqual(newP.productID, p.productID); Assert.AreEqual(newP.description, p.description); }
public void SetUp() { p = new ProductProps(); p.productID = 100; p.productCode = "xxx"; p.description = "my test product"; p.onHandQuantity = 2; p.price = 99; }
public void TestSetState() { string xml = props1.GetState(); ProductProps props2 = new ProductProps(); props2.SetState(xml); Assert.AreEqual(props1.ProductCode, props2.ProductCode); Assert.AreEqual(props1.Description, props2.Description); }
public void SetupAllTests() { props1 = new ProductProps(); props1.ProductCode = "zzzz "; props1.Description = "Test"; props1.UnitPrice = 300.00m; props1.OnHandQuantity = 1234; props1.ConcurrencyID = 12; }
public void Setup() { props1 = new ProductProps(); props1.ID = 1; props1.productcode = "12"; props1.description = "Description"; props1.unitprice = 12.50m; props1.onhandquantity = 5; props1.ConcurrencyID = 10; }
public void Setup() { testp = new ProductProps(); testp.ID = 1; testp.quantity = 10; testp.code = "XXXX"; testp.price = 99.99m; testp.description = "This is a test product"; testp.ConcurrencyID = 1; }