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 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 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 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"); }