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_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 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 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 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 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_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 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 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 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 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 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 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(); }
public void MonthlySales_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 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("4", "2008"); Assert.IsTrue(int.Parse(s) == 34000); tf.DeleteSale("3", "121", "9"); }