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 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 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 AddSale_Duplicate() { 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(); sa.CreateSale(); try { tf.DeleteSale("3", "121", "9"); } 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 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 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 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 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"); }
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 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"); }