public void MonthlySales_OneSaleWrongDate() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); TestingFunctions tf = new TestingFunctions(db.GetDB()); try { tf.DeleteSale("3", "121", "9"); } catch (Exception e) { } String[] sale = new String[] { "3", "121", "9", "4/10/2008", "34000" }; MakeSale sa = new MakeSale(sale, db.GetDB()); sa.CreateSale(); String s = st.MonthlySales("11", "2003"); Assert.IsTrue(int.Parse(s) == 0); tf.DeleteSale("3", "121", "9"); }
public void AddSale_CIDNonExistent() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); TestingFunctions tf = new TestingFunctions(db.GetDB()); try { tf.DeleteSale("3", "121", "9"); } catch (Exception e) { } String[] sale = new String[] { "3", "99999", "9", "4/10/2008", "34000" }; MakeSale sa = new MakeSale(sale, db.GetDB()); sa.CreateSale(); try { tf.DeleteSale("3", "99999", "0"); } catch (Exception e) { } }
public void EmployeeProgress_NormalPath() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); TestingFunctions tf = new TestingFunctions(db.GetDB()); try { tf.DeleteSale("3", "121", "9"); } catch (Exception e) { } String[] sale = new String[] { "3", "121", "9", "4/10/2008", "34000" }; MakeSale sa = new MakeSale(sale, db.GetDB()); sa.CreateSale(); DataTable dt = st.CalculateProgress(); Double actual = (Double)dt.Rows[0].ItemArray[2]; Double expected = 34000; Assert.IsTrue(actual == expected); tf.DeleteSale("3", "121", "9"); }
public void SearchName_EmptyName() { //Person array = id, name, phone no, address, sex DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); //String[] p = new String[] { "1", "1", "1", "1", "1" }; //MakePerson_Accessor Person = new MakePerson_Accessor(p, connection.GetDB()); //Person.DeletePerson(); //Person.CreatePerson(); try { dt = SF.SearchPersonName(""); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt.Rows.Count == 0); //Person.DeletePerson(); }
public void AddCustomerControl_createDuplicate() { DBConnection_Accessor db = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(db.GetDB()); SearchFunction_Accessor sf = new SearchFunction_Accessor(db.GetDB()); AddCustomerControl_Accessor aec = new AddCustomerControl_Accessor(db.GetDB()); String[] D = new String[] { "10011", "Sean", "5555555555", "calgary", "M", "10011", "Customer" }; MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB()); try { d.DeletePerson(10011); } catch (Exception) { } aec.createCustomer(D); ErrorWindow ew = aec.createCustomer(D); DataTable dt = sf.SearchPersonID("10011"); Assert.IsTrue(dt.Rows.Count == 1); Assert.IsNotNull(ew); }
public void DeletePerson_NormalPath() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); Delete_Accessor d = new Delete_Accessor(connection.GetDB()); try { d.DeletePerson(1005); } catch (Exception e) { } String[] p = new String[] {"1005", "1", "1123123123", "1", "M"}; MakePerson_Accessor pers = new MakePerson_Accessor(p, connection.GetDB()); pers.CreatePerson(); MakeEmployee_Accessor person = new MakeEmployee_Accessor("1005", "1234", "3/3/3", "", connection.GetDB()); person.CreateEmployee(); d.DeletePerson(1005); try { dt = SF.SearchPersonID("1005"); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt.Rows.Count == 0); }
public void AddCustomerControl_badPhoneNumber() { DBConnection_Accessor db = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(db.GetDB()); SearchFunction_Accessor sf = new SearchFunction_Accessor(db.GetDB()); AddCustomerControl_Accessor aec = new AddCustomerControl_Accessor(db.GetDB()); String[] D = new String[] { "10011", "Sean", "5555555555", "calgary", "M", "10011", "Customer" }; MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB()); try { d.DeletePerson(10011); } catch (Exception) { } ErrorWindow ew = aec.createCustomer(D); DataTable dt = null; try { dt = sf.SearchPersonID("10011"); } catch (Exception e) { }; Assert.IsTrue(dt.Rows.Count == 0); Assert.IsNotNull(ew); }
public void EmployeeProgress_NormalPath() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); TestingFunctions tf = new TestingFunctions(db.GetDB()); try { tf.DeleteSale("3", "121", "9"); } catch (Exception e) { } String[] sale = new String[] { "3", "121", "9", "4/10/2008", "34000" }; MakeSale sa = new MakeSale(sale, db.GetDB()); sa.CreateSale(); DataTable dt = st.CalculateProgress(); Double actual = (Double)dt.Rows[0].ItemArray[2]; Double expected = 34000; Assert.IsTrue(actual == expected); tf.DeleteSale("3", "121", "9"); }
public void RevenueTest_OneSale() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); TestingFunctions tf = new TestingFunctions(db.GetDB()); try { tf.DeleteSale("3", "121", "9"); } catch (Exception) { } String[] sale = new String[] { "3", "121", "9", "3/3/3", "1200" }; MakeSale sa = new MakeSale(sale, db.GetDB()); sa.CreateSale(); String s = st.Revenue(); Assert.IsTrue(int.Parse(s) == 1200); tf.DeleteSale("3", "121", "9"); }
public void AddSale_EIDNonExistent() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); TestingFunctions tf = new TestingFunctions(db.GetDB()); try { tf.DeleteSale("3", "121", "99999"); } catch (Exception e) { } String[] sale = new String[] { "3", "121", "99999", "4/10/2008", "34000" }; MakeSale sa = new MakeSale(sale, db.GetDB()); sa.CreateSale(); try { tf.DeleteSale("3", "121", "99999"); } catch (Exception e) { } }
public void RevenueTest_DecimalSales() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); TestingFunctions tf = new TestingFunctions(db.GetDB()); try { tf.DeleteSale("3", "121", "9"); tf.DeleteSale("7", "121", "9"); } catch (Exception) { } String[] sale = new String[] { "3", "121", "9", "3/3/3", "1200.3" }; MakeSale sa = new MakeSale(sale, db.GetDB()); sa.CreateSale(); String[] sale2 = new String[] { "7", "121", "9", "3/3/3", "1200.75" }; MakeSale sa2 = new MakeSale(sale2, db.GetDB()); sa2.CreateSale(); String s = st.Revenue(); Assert.IsTrue(double.Parse(s) == 2401.05); tf.DeleteSale("3", "121", "9"); tf.DeleteSale("7", "121", "9"); }
public void RevenueTest_MultipleSales() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); TestingFunctions tf = new TestingFunctions(db.GetDB()); try { tf.DeleteSale("3", "121", "9"); tf.DeleteSale("7", "121", "9"); } catch (Exception) { } String[] sale = new String[] { "3", "121", "9", "3/3/3", "1200" }; MakeSale sa = new MakeSale(sale, db.GetDB()); sa.CreateSale(); String[] sale2 = new String[] { "7", "121", "9", "3/3/3", "1200" }; MakeSale sa2 = new MakeSale(sale2, db.GetDB()); sa2.CreateSale(); String s = st.Revenue(); Assert.IsTrue(int.Parse(s) == 2400); tf.DeleteSale("3", "121", "9"); tf.DeleteSale("7", "121", "9"); }
public void DeletePart_NormalPath() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); Delete_Accessor d = new Delete_Accessor(connection.GetDB()); try { d.DeletePart(10); } catch (Exception e) { } String[] D = new String[] { "10", "3", "1", "1" }; MakePart_Accessor part = new MakePart_Accessor(D, connection.GetDB()); part.CreatePart(); d.DeletePart(10); try { dt = SF.SearchPart("10"); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt.Rows.Count == 0); }
public void SearchName_NonExistent() { //Person array = id, name, phone no, address, sex DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); //String[] p = new String[] { "1", "1", "1", "1", "1" }; //MakePerson_Accessor Person = new MakePerson_Accessor(p, connection.GetDB()); //Person.DeletePerson(); //Person.CreatePerson(); try { dt = SF.SearchPersonName("dyrone tonkson"); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt.Rows.Count == 0); //Person.DeletePerson(); }
public void DeletePart_NormalPath() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); Delete_Accessor d = new Delete_Accessor(connection.GetDB()); try { d.DeletePart(10); } catch (Exception e) { } String[] D = new String[] {"10", "3", "1", "1"}; MakePart_Accessor part = new MakePart_Accessor(D, connection.GetDB()); part.CreatePart(); d.DeletePart(10); try { dt = SF.SearchPart("10"); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt.Rows.Count == 0); }
public void MonthlySales_NoSalesValidMonth() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); string s = st.MonthlySales("1", "2001"); Assert.IsTrue(int.Parse(s) == 0); }
public void SearchSale_NormalPath() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); TestingFunctions tf = new TestingFunctions(connection.GetDB()); try { tf.DeleteSale("3", "121", "9"); } catch (Exception e) { } String[] sale = new String[] { "3", "121", "9", "4/10/2008", "34000" }; MakeSale sa = new MakeSale(sale, connection.GetDB()); sa.CreateSale(); try { dt = SF.SearchSale("9", "121", "3"); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt.Rows.Count == 1); tf.DeleteSale("3", "121", "9"); }
public void SearchID_NormalPath() { //Person array = id, name, phone no, address, sex DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); //String[] p = new String[] {"1", "1", "1", "1", "1"}; /* MakePerson_Accessor Person = new MakePerson_Accessor(p, connection.GetDB()); Person.DeletePerson(); Person.CreatePerson(); */ try { dt = SF.SearchPersonID("3"); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt.Rows.Count == 1); //Person.DeletePerson(); }
public void AddEmployeeControl_negativeIDValue() { DBConnection_Accessor db = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(db.GetDB()); SearchFunction_Accessor sf = new SearchFunction_Accessor(db.GetDB()); AddEmployeeControl_Accessor aec = new AddEmployeeControl_Accessor(db.GetDB()); try { d.DeletePerson(-500); } catch (Exception) { } String[] D = new String[] { "-500", "", "", "", "", "-500", "", "", "" }; ErrorWindow ew = aec.createEmployee(D); DataTable dt = null; try { dt = sf.SearchPersonID("abc"); } catch (Exception e) { }; Assert.IsTrue(dt.Rows.Count == 0); Assert.IsNotNull(ew); }
public void AddCustomerControl_constructor() { DBConnection_Accessor db = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(db.GetDB()); AddCustomerControl_Accessor acc = new AddCustomerControl_Accessor(db.GetDB()); Assert.IsNotNull(acc); }
public void AddCustomerControl_constructor() { DBConnection_Accessor db = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(db.GetDB()); AddCustomerControl_Accessor acc = new AddCustomerControl_Accessor(db.GetDB()); Assert.IsNotNull(acc); }
public void VehicleParts_NoVehicle() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); DataTable dt = st.VehicleParts("2"); Assert.IsTrue(dt.Rows.Count == 0); }
public void AddEmployeeControl_constructor() { DBConnection_Accessor db = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(db.GetDB()); AddEmployeeControl_Accessor aec = new AddEmployeeControl_Accessor(db.GetDB()); Assert.IsNotNull(aec); }
public void MonthlySales_NoSalesValidMonth() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); string s = st.MonthlySales("1", "2001"); Assert.IsTrue(int.Parse(s) == 0); }
public void VehicleParts_Empty() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); DataTable dt = st.VehicleParts(""); Assert.IsTrue(dt.Rows.Count == 0); }
public void EmployeeProgress_NoSales() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); DataTable dt = st.CalculateProgress(); Assert.IsTrue(dt.Rows.Count == 0); }
public void RevenueTest_NoSale() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); String s = st.Revenue(); //seems to give back a string as only "$" when no sales so asserting doesn't work }
public void EmployeeProgress_NoSales() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); DataTable dt = st.CalculateProgress(); Assert.IsTrue(dt.Rows.Count == 0); }
public void AddVHR_NullID() { DBConnection_Accessor db = new DBConnection_Accessor(); String[] D = new String[] { "", "", "", "", "", "" }; MakeVHR_Accessor mc = new MakeVHR_Accessor(D, db.GetDB()); TestingFunctions t = new TestingFunctions(db.GetDB()); MakeVehicle_Accessor mp = new MakeVehicle_Accessor(D, db.GetDB()); mc.CreateVHR(); }
public void TruckInventory_NormalPath() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); DataTable dt = new DataTable(); dt = st.TrucksInventory(); DataColumn[] dc = new DataColumn[] { dt.Columns[0] }; dt.PrimaryKey = dc; Assert.IsTrue(dt.Rows.Contains("5")); }
public void GUIAddCarTest_NormalPath() { // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items. // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463 UIMap.GUIAddCar_NormalPath(); DBConnection_Accessor db = new DBConnection_Accessor(); SearchFunction_Accessor sc = new SearchFunction_Accessor(db.GetDB()); DataTable dt = sc.SearchVehicle("55555"); int expected = 1; int actual = dt.Rows.Count; Assert.AreEqual(expected, actual); }
public void AddSale_NullVIN() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); TestingFunctions tf = new TestingFunctions(db.GetDB()); String[] sale = new String[] { "", "121", "9", "4/10/2008", "34000" }; MakeSale sa = new MakeSale(sale, db.GetDB()); sa.CreateSale(); }
public void CarInventory_Sold() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); DataTable dt = new DataTable(); dt = st.CarsInventory(); DataColumn[] dc = new DataColumn[] { dt.Columns[0] }; dt.PrimaryKey = dc; Assert.IsFalse(dt.Rows.Contains("12345")); }
public void AddPart_NullID() { DBConnection_Accessor db = new DBConnection_Accessor(); String[] D = new String[] { "", "", "", "", "", "" }; MakePart_Accessor mc = new MakePart_Accessor(D, db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); MakeVehicle_Accessor mp = new MakeVehicle_Accessor(D, db.GetDB()); mc.CreatePart(); }
public void DeleteVehicle_ExistsInSale() { DBConnection_Accessor connection = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(connection.GetDB()); TestingFunctions tf = new TestingFunctions(connection.GetDB()); try { tf.DeleteSale("112", "121", "9"); } catch (Exception e) { } try { d.DeleteVehicle(112); } catch (Exception e) { } String[] D = new String[] { "112", "1", "1", "1", "1", "1" }; MakeVehicle_Accessor veh = new MakeVehicle_Accessor(D, connection.GetDB()); veh.CreateVehicle(); MakeCar_Accessor car = new MakeCar_Accessor("112", "smart car", connection.GetDB()); car.CreateCar(); String[] sale = new String[] { "112", "121", "9", "4/10/2008", "34000" }; MakeSale sa = new MakeSale(sale, connection.GetDB()); sa.CreateSale(); try { d.DeleteVehicle(112); } catch (Exception ex) { try { tf.DeleteSale("112", "121", "9"); } catch (Exception e) { } throw ex; } }
public void AddEmployee_NullID() { DBConnection_Accessor db = new DBConnection_Accessor(); MakeEmployee_Accessor mc = new MakeEmployee_Accessor("", "", "", "", db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); String[] D = new String[] { "", "", "", "", "" }; MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB()); mp.CreatePerson(); mc.CreateEmployee(); }
public void GUIAddCarTest_NormalPath() { // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items. // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463 UIMap.GUIAddCar_NormalPath(); DBConnection_Accessor db = new DBConnection_Accessor(); SearchFunction_Accessor sc = new SearchFunction_Accessor(db.GetDB()); DataTable dt = sc.SearchVehicle("55555"); int expected = 1; int actual = dt.Rows.Count; Assert.AreEqual(expected, actual); }
public void AddTruck_NullID() { DBConnection_Accessor db = new DBConnection_Accessor(); MakeTruck_Accessor mc = new MakeTruck_Accessor("", "", db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); String[] D = new String[] { "", "", "", "", "", "" }; MakeVehicle_Accessor mp = new MakeVehicle_Accessor(D, db.GetDB()); mp.CreateVehicle(); mc.CreateTruck(); }
public void CarInventory_NormalPath() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); DataTable dt = new DataTable(); dt = st.CarsInventory(); DataColumn[] dc = new DataColumn[] { dt.Columns[0] }; dt.PrimaryKey = dc; Assert.IsTrue(dt.Rows.Contains("8")); }
public void MonthlySales_InvalidYear() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); try { String s = st.MonthlySales("3", "-39"); } catch (ArgumentException ae) { throw ae; } }
public void TruckInventory_Sold() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); DataTable dt = new DataTable(); dt = st.TrucksInventory(); DataColumn[] dc = new DataColumn[] { dt.Columns[0] }; dt.PrimaryKey = dc; Assert.IsFalse(dt.Rows.Contains("133734")); }
public void MonthlySales_InvalidYear() { DBConnection_Accessor db = new DBConnection_Accessor(); StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB()); try { String s = st.MonthlySales("3", "-39"); } catch (ArgumentException ae) { throw ae; } }
public void SearchVehicle_EmptyID() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); try { dt = SF.SearchVehicle(""); } catch (OleDbException ex) { throw ex; } }
public void SearchVHR_EmptyID() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); try { dt = SF.SearchVHR(""); } catch (OleDbException ex) { throw ex; } }
public void DeleteVehicle_NonExistent() { DBConnection_Accessor connection = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(connection.GetDB()); try { d.DeleteVehicle(23452345); } catch (OleDbException ex) { throw ex; } }
public void DeleteVehicle_Empty() { DBConnection_Accessor connection = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(connection.GetDB()); try { d.DeleteVehicle(new int()); } catch (OleDbException ex) { throw ex; } }
public void DeletePart_NonExistent() { DBConnection_Accessor connection = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(connection.GetDB()); try { d.DeletePart(10); } catch (OleDbException ex) { throw ex; } }
public void DeleteVehicle_Empty() { DBConnection_Accessor connection = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(connection.GetDB()); try { d.DeleteVehicle(new int()); } catch (OleDbException ex) { throw ex; } }
public void DeleteVehicle_ExistsInSale() { DBConnection_Accessor connection = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(connection.GetDB()); TestingFunctions tf = new TestingFunctions(connection.GetDB()); try { tf.DeleteSale("112", "121", "9"); } catch (Exception e) { } try { d.DeleteVehicle(112); } catch (Exception e) { } String[] D = new String[] { "112", "1", "1", "1", "1", "1" }; MakeVehicle_Accessor veh = new MakeVehicle_Accessor(D, connection.GetDB()); veh.CreateVehicle(); MakeCar_Accessor car = new MakeCar_Accessor("112", "smart car", connection.GetDB()); car.CreateCar(); String[] sale = new String[] { "112", "121", "9", "4/10/2008", "34000" }; MakeSale sa = new MakeSale(sale, connection.GetDB()); sa.CreateSale(); try { d.DeleteVehicle(112); } catch (Exception ex) { try { tf.DeleteSale("112", "121", "9"); } catch (Exception e) { } throw ex; } }
public void SearchVehicle_NormalPath() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); try { dt = SF.SearchVehicle("3"); } catch (OleDbException ex) { } Assert.IsTrue(dt.Rows.Count == 1); }
public void SearchVHR_NormalPath() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); try { dt = SF.SearchVHR("121"); } catch (OleDbException ex) { } Assert.IsTrue(dt.Rows.Count == 1); }
public void SearchSale_EmptyEID() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); try { dt = SF.SearchSale("", "121", "3"); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt.Rows.Count == 0); }
public void SearchVehicle_NonExistent() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); try { dt = SF.SearchVehicle("2"); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt.Rows.Count == 0); }
public void SearchName_NormalPath() { DBConnection_Accessor connection = new DBConnection_Accessor(); SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB()); DataTable dt = new DataTable(); try { dt = SF.SearchPersonName("hi there"); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt.Rows.Count == 1); }
public void AddEngine_DeleteInstance() { DBConnection_Accessor db = new DBConnection_Accessor(); MakeEngine_Accessor mc = new MakeEngine_Accessor("1", "", "", db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); String[] D = new String[] { "1", "", "", "", "", "" }; MakePart_Accessor mp = new MakePart_Accessor(D, db.GetDB()); try { d.DeletePart(1); } catch (Exception) { } mp.CreatePart(); mc.CreateEngine(); SearchFunction_Accessor SF = new SearchFunction_Accessor(db.GetDB()); DataTable dt1 = new DataTable(); DataTable dt2 = new DataTable(); try { dt2 = SF.SearchPart("1"); } catch (OleDbException ex) { throw ex; } mc.DeleteEngine(); mp.DeletePart(); try { dt1 = SF.SearchPart("1"); } catch (OleDbException ex) { throw ex; } Assert.IsTrue(dt1.Rows.Count == 0 && dt2.Rows.Count == 1); }
public void AddVHR_NegativeID() { DBConnection_Accessor db = new DBConnection_Accessor(); String[] D = new String[] { "-5", "22", "", "", "", "" }; MakeVHR_Accessor mc = new MakeVHR_Accessor(D, db.GetDB()); TestingFunctions t = new TestingFunctions(db.GetDB()); MakeVehicle_Accessor mp = new MakeVehicle_Accessor(D, db.GetDB()); try { t.DeleteVHR(-5); } catch (Exception) { } mc.CreateVHR(); }
public void AddCustomerControl_badIDValue() { DBConnection_Accessor db = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(db.GetDB()); SearchFunction_Accessor sf = new SearchFunction_Accessor(db.GetDB()); AddCustomerControl_Accessor aec = new AddCustomerControl_Accessor(db.GetDB()); String[] D = new String[] { "abc", "", "", "", "", "abc", "Customer" }; ErrorWindow ew = aec.createCustomer(D); DataTable dt = null; try { dt = sf.SearchPersonID("abc"); } catch (Exception e) { }; Assert.IsTrue(dt.Rows.Count == 0); Assert.IsNotNull(ew); }
public void AddCustomer_BadIDFormat() { DBConnection_Accessor db = new DBConnection_Accessor(); MakeCustomer_Accessor mc = new MakeCustomer_Accessor("abc", "", db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); String[] D = new String[] { "abc", "", "", "", "" }; MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB()); try { d.DeletePerson(1); } catch (Exception) { } mp.CreatePerson(); mc.CreateCustomer(); }
public void AddEmployee_BadManIDFormat() { DBConnection_Accessor db = new DBConnection_Accessor(); MakeEmployee_Accessor mc = new MakeEmployee_Accessor("1114", "", "", "abc", db.GetDB()); Delete_Accessor d = new Delete_Accessor(db.GetDB()); String[] D = new String[] { "1114", "", "", "", "" }; MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB()); try { d.DeletePerson(1114); } catch (Exception) { } mp.CreatePerson(); mc.CreateEmployee(); }
public void AddVHR_NormalPath() { DBConnection_Accessor db = new DBConnection_Accessor(); String[] D = new String[] { "1", "22", "123", "123", "123", "123" }; MakeVHR_Accessor mc = new MakeVHR_Accessor(D, db.GetDB()); TestingFunctions t = new TestingFunctions(db.GetDB()); MakeVehicle_Accessor mp = new MakeVehicle_Accessor(D, db.GetDB()); try { t.DeleteVHR(1); } catch (Exception) { } mc.CreateVHR(); }