public void FetchProductTest() { DBManager_Accessor target = new DBManager_Accessor(); // TODO: Initialize to an appropriate value DataTable expected = null; // TODO: Initialize to an appropriate value DataTable actual; actual = target.FetchProduct(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void AddProductTest() { DBManager_Accessor target = new DBManager_Accessor(); // TODO: Initialize to an appropriate value string manufacturerName = "3M"; // TODO: Initialize to an appropriate value string productID = "88888888"; // TODO: Initialize to an appropriate value string name = "just for test"; // TODO: Initialize to an appropriate value string category = "just for test"; // TODO: Initialize to an appropriate value bool perishable = false; // TODO: Initialize to an appropriate value //target.AddProduct(manufacturerName, productID, name, category, perishable); DataTable dtExpected = new DataTable(); DataTable dtResult = target.FetchProduct(); try { dtExpected.Columns.Add("Manufacturer", typeof(string)); dtExpected.Columns.Add("ProductID", typeof(string)); dtExpected.Columns.Add("Name", typeof(string)); dtExpected.Columns.Add("Category", typeof(string)); dtExpected.Columns.Add("Perishable", typeof(bool)); dtExpected.Rows.Add(manufacturerName, productID, name, category, perishable); //Comparison for (int i = 0; i < dtResult.Rows.Count; i++) { if (dtResult.Rows[i]["ProductID"].ToString().Equals(dtExpected.Rows[0]["ProductID"].ToString())) { Assert.AreEqual(dtResult.Rows[i]["ManufacturerName"].ToString(), dtExpected.Rows[0]["ManufacturerName"].ToString()); Assert.AreEqual(dtResult.Rows[i]["Name"].ToString(), dtExpected.Rows[0]["Name"].ToString()); Assert.AreEqual(dtResult.Rows[i]["Category"].ToString(), dtExpected.Rows[0]["Category"].ToString()); Assert.AreEqual(dtResult.Rows[i]["Perishable"].ToString(), dtExpected.Rows[0]["Perishable"].ToString()); } } } catch { target.DeleteProduct(productID); } }