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 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) { } }
private void SubmitSaleButton_Click(object sender, RoutedEventArgs e) { string[] Data = new string[5]; Data[0] = VehicleText.GetLineText(0); Data[1] = CustomerText.GetLineText(0); Data[2] = EmployeeText.GetLineText(0); Data[3] = DateText.GetLineText(0); Data[4] = PriceText.GetLineText(0); MakeSale S = new MakeSale(Data, cn); try { S.CreateSale(); } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); return; } VehicleText.Clear(); CustomerText.Clear(); EmployeeText.Clear(); DateText.Clear(); PriceText.Clear(); }
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 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 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"); }