Exemplo n.º 1
0
        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");
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
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");
        }
Exemplo n.º 4
0
        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");
        }
Exemplo n.º 5
0
        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");
        }
Exemplo n.º 6
0
        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");
        }
Exemplo n.º 7
0
        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)
            {
            }
        }
Exemplo n.º 8
0
        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)
            {
            }
        }
Exemplo n.º 9
0
        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");
        }
Exemplo n.º 10
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();
        }
Exemplo n.º 11
0
        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();
        }
Exemplo n.º 12
0
        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;
            }
        }
Exemplo n.º 13
0
        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;
            }
        }
Exemplo n.º 14
0
        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();
        }
Exemplo n.º 15
0
        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();
        }
Exemplo n.º 16
0
        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();
        }
Exemplo n.º 17
0
        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();
        }
Exemplo n.º 18
0
        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");
        }
Exemplo n.º 19
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");
        }
Exemplo n.º 20
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();
        }
Exemplo n.º 21
0
        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();
        }