Exemplo n.º 1
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.º 2
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.º 3
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");
        }
        public void SearchName_EmptyName()
        {
            //Person array = id, name, phone no, address, sex
            DBConnection_Accessor   connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF         = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();

            //String[] p = new String[] { "1", "1", "1", "1", "1" };



            //MakePerson_Accessor Person = new MakePerson_Accessor(p, connection.GetDB());
            //Person.DeletePerson();
            //Person.CreatePerson();

            try
            {
                dt = SF.SearchPersonName("");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 0);



            //Person.DeletePerson();
        }
Exemplo n.º 5
0
        public void AddCustomerControl_createDuplicate()
        {
            DBConnection_Accessor       db  = new DBConnection_Accessor();
            Delete_Accessor             d   = new Delete_Accessor(db.GetDB());
            SearchFunction_Accessor     sf  = new SearchFunction_Accessor(db.GetDB());
            AddCustomerControl_Accessor aec = new AddCustomerControl_Accessor(db.GetDB());

            String[] D = new String[] { "10011", "Sean", "5555555555", "calgary", "M", "10011", "Customer" };

            MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB());

            try
            {
                d.DeletePerson(10011);
            }
            catch (Exception)
            {
            }
            aec.createCustomer(D);
            ErrorWindow ew = aec.createCustomer(D);
            DataTable   dt = sf.SearchPersonID("10011");

            Assert.IsTrue(dt.Rows.Count == 1);
            Assert.IsNotNull(ew);
        }
Exemplo n.º 6
0
        public void DeletePerson_NormalPath()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();
            Delete_Accessor d = new Delete_Accessor(connection.GetDB());
            try
            {
                d.DeletePerson(1005);
            }
            catch (Exception e)
            {
            }
            String[] p = new String[] {"1005", "1", "1123123123", "1", "M"};
            MakePerson_Accessor pers = new MakePerson_Accessor(p, connection.GetDB());
            pers.CreatePerson();
            MakeEmployee_Accessor person = new MakeEmployee_Accessor("1005", "1234", "3/3/3", "", connection.GetDB());

            person.CreateEmployee();

            d.DeletePerson(1005);

            try
            {
                dt = SF.SearchPersonID("1005");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 0);
        }
Exemplo n.º 7
0
        public void AddCustomerControl_badPhoneNumber()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            SearchFunction_Accessor sf = new SearchFunction_Accessor(db.GetDB());
            AddCustomerControl_Accessor aec = new AddCustomerControl_Accessor(db.GetDB());

            String[] D = new String[] { "10011", "Sean", "5555555555", "calgary", "M", "10011", "Customer" };

            MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB());
            try
            {
                d.DeletePerson(10011);
            }
            catch (Exception)
            {

            }

            ErrorWindow ew = aec.createCustomer(D);
            DataTable dt = null;
            try
            {
                dt = sf.SearchPersonID("10011");
            }
            catch (Exception e) { };
            Assert.IsTrue(dt.Rows.Count == 0);
            Assert.IsNotNull(ew);
        }
Exemplo n.º 8
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.º 9
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.º 10
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.º 11
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.º 12
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.º 13
0
        public void DeletePart_NormalPath()
        {
            DBConnection_Accessor   connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF         = new SearchFunction_Accessor(connection.GetDB());
            DataTable       dt = new DataTable();
            Delete_Accessor d  = new Delete_Accessor(connection.GetDB());

            try
            {
                d.DeletePart(10);
            }
            catch (Exception e)
            {
            }

            String[]          D    = new String[] { "10", "3", "1", "1" };
            MakePart_Accessor part = new MakePart_Accessor(D, connection.GetDB());

            part.CreatePart();


            d.DeletePart(10);

            try
            {
                dt = SF.SearchPart("10");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 0);
        }
Exemplo n.º 14
0
        public void SearchName_NonExistent()
        {
            //Person array = id, name, phone no, address, sex
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();
            //String[] p = new String[] { "1", "1", "1", "1", "1" };

            //MakePerson_Accessor Person = new MakePerson_Accessor(p, connection.GetDB());
            //Person.DeletePerson();
            //Person.CreatePerson();

            try
            {
                dt = SF.SearchPersonName("dyrone tonkson");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 0);

            //Person.DeletePerson();
        }
Exemplo n.º 15
0
        public void DeletePart_NormalPath()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();
            Delete_Accessor d = new Delete_Accessor(connection.GetDB());
            try
            {
                d.DeletePart(10);
            }
            catch (Exception e)
            {
            }

            String[] D = new String[] {"10", "3", "1", "1"};
            MakePart_Accessor part = new MakePart_Accessor(D, connection.GetDB());
            part.CreatePart();

            d.DeletePart(10);

            try
            {
                dt = SF.SearchPart("10");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 0);
        }
Exemplo n.º 16
0
 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);
 }
Exemplo n.º 17
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.º 18
0
        public void SearchID_NormalPath()
        {
            //Person array = id, name, phone no, address, sex
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();
            //String[] p = new String[] {"1", "1", "1", "1", "1"};

            /*
            MakePerson_Accessor Person = new MakePerson_Accessor(p, connection.GetDB());
            Person.DeletePerson();
            Person.CreatePerson();
            */
            try
            {
                dt = SF.SearchPersonID("3");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 1);

            //Person.DeletePerson();
        }
Exemplo n.º 19
0
        public void AddEmployeeControl_negativeIDValue()
        {
            DBConnection_Accessor       db  = new DBConnection_Accessor();
            Delete_Accessor             d   = new Delete_Accessor(db.GetDB());
            SearchFunction_Accessor     sf  = new SearchFunction_Accessor(db.GetDB());
            AddEmployeeControl_Accessor aec = new AddEmployeeControl_Accessor(db.GetDB());

            try
            {
                d.DeletePerson(-500);
            }
            catch (Exception)
            {
            }
            String[] D = new String[] { "-500", "", "", "", "", "-500", "", "", "" };

            ErrorWindow ew = aec.createEmployee(D);
            DataTable   dt = null;

            try
            {
                dt = sf.SearchPersonID("abc");
            }
            catch (Exception e) { };
            Assert.IsTrue(dt.Rows.Count == 0);
            Assert.IsNotNull(ew);
        }
Exemplo n.º 20
0
        public void AddCustomerControl_constructor()
        {
            DBConnection_Accessor       db  = new DBConnection_Accessor();
            Delete_Accessor             d   = new Delete_Accessor(db.GetDB());
            AddCustomerControl_Accessor acc = new AddCustomerControl_Accessor(db.GetDB());

            Assert.IsNotNull(acc);
        }
Exemplo n.º 21
0
        public void AddCustomerControl_constructor()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            AddCustomerControl_Accessor acc = new AddCustomerControl_Accessor(db.GetDB());

            Assert.IsNotNull(acc);
        }
Exemplo n.º 22
0
        public void VehicleParts_NoVehicle()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB());

            DataTable dt = st.VehicleParts("2");
            Assert.IsTrue(dt.Rows.Count == 0);
        }
Exemplo n.º 23
0
        public void AddEmployeeControl_constructor()
        {
            DBConnection_Accessor       db  = new DBConnection_Accessor();
            Delete_Accessor             d   = new Delete_Accessor(db.GetDB());
            AddEmployeeControl_Accessor aec = new AddEmployeeControl_Accessor(db.GetDB());

            Assert.IsNotNull(aec);
        }
Exemplo n.º 24
0
        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);
        }
Exemplo n.º 25
0
        public void VehicleParts_Empty()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor    st = new StatsCalc_Accessor(db.GetDB());

            DataTable dt = st.VehicleParts("");

            Assert.IsTrue(dt.Rows.Count == 0);
        }
Exemplo n.º 26
0
        public void EmployeeProgress_NoSales()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor    st = new StatsCalc_Accessor(db.GetDB());

            DataTable dt = st.CalculateProgress();

            Assert.IsTrue(dt.Rows.Count == 0);
        }
Exemplo n.º 27
0
        public void RevenueTest_NoSale()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor    st = new StatsCalc_Accessor(db.GetDB());

            String s = st.Revenue();

            //seems to give back a string as only "$" when no sales so asserting doesn't work
        }
Exemplo n.º 28
0
        public void EmployeeProgress_NoSales()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB());

            DataTable dt = st.CalculateProgress();

            Assert.IsTrue(dt.Rows.Count == 0);
        }
Exemplo n.º 29
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.º 30
0
        public void TruckInventory_NormalPath()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB());

            DataTable dt = new DataTable();
            dt = st.TrucksInventory();
            DataColumn[] dc = new DataColumn[] { dt.Columns[0] };
            dt.PrimaryKey = dc;

            Assert.IsTrue(dt.Rows.Contains("5"));
        }
Exemplo n.º 31
0
 public void GUIAddCarTest_NormalPath()
 {
     // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
     // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
     UIMap.GUIAddCar_NormalPath();
     DBConnection_Accessor db = new DBConnection_Accessor();
     SearchFunction_Accessor sc = new SearchFunction_Accessor(db.GetDB());
     DataTable dt = sc.SearchVehicle("55555");
     int expected = 1;
     int actual = dt.Rows.Count;
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 32
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.º 33
0
        public void CarInventory_Sold()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB());

            DataTable dt = new DataTable();
            dt = st.CarsInventory();
            DataColumn[] dc = new DataColumn[] { dt.Columns[0] };
            dt.PrimaryKey = dc;

            Assert.IsFalse(dt.Rows.Contains("12345"));
        }
Exemplo n.º 34
0
        public void AddPart_NullID()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();

            String[]          D  = new String[] { "", "", "", "", "", "" };
            MakePart_Accessor mc = new MakePart_Accessor(D, db.GetDB());
            Delete_Accessor   d  = new Delete_Accessor(db.GetDB());

            MakeVehicle_Accessor mp = new MakeVehicle_Accessor(D, db.GetDB());

            mc.CreatePart();
        }
Exemplo n.º 35
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.º 36
0
        public void AddEmployee_NullID()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("", "", "", "", db.GetDB());
            Delete_Accessor       d  = new Delete_Accessor(db.GetDB());

            String[] D = new String[] { "", "", "", "", "" };

            MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB());

            mp.CreatePerson();
            mc.CreateEmployee();
        }
Exemplo n.º 37
0
        public void GUIAddCarTest_NormalPath()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            UIMap.GUIAddCar_NormalPath();
            DBConnection_Accessor   db = new DBConnection_Accessor();
            SearchFunction_Accessor sc = new SearchFunction_Accessor(db.GetDB());
            DataTable dt       = sc.SearchVehicle("55555");
            int       expected = 1;
            int       actual   = dt.Rows.Count;

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 38
0
        public void AddTruck_NullID()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeTruck_Accessor    mc = new MakeTruck_Accessor("", "", db.GetDB());
            Delete_Accessor       d  = new Delete_Accessor(db.GetDB());

            String[] D = new String[] { "", "", "", "", "", "" };

            MakeVehicle_Accessor mp = new MakeVehicle_Accessor(D, db.GetDB());

            mp.CreateVehicle();
            mc.CreateTruck();
        }
Exemplo n.º 39
0
        public void CarInventory_NormalPath()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor    st = new StatsCalc_Accessor(db.GetDB());

            DataTable dt = new DataTable();

            dt = st.CarsInventory();
            DataColumn[] dc = new DataColumn[] { dt.Columns[0] };
            dt.PrimaryKey = dc;

            Assert.IsTrue(dt.Rows.Contains("8"));
        }
Exemplo n.º 40
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;
     }
 }
Exemplo n.º 41
0
        public void TruckInventory_Sold()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor    st = new StatsCalc_Accessor(db.GetDB());

            DataTable dt = new DataTable();

            dt = st.TrucksInventory();
            DataColumn[] dc = new DataColumn[] { dt.Columns[0] };
            dt.PrimaryKey = dc;

            Assert.IsFalse(dt.Rows.Contains("133734"));
        }
Exemplo n.º 42
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;
            }
        }
Exemplo n.º 43
0
        public void SearchVehicle_EmptyID()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();

            try
            {
                dt = SF.SearchVehicle("");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 44
0
        public void SearchVHR_EmptyID()
        {
            DBConnection_Accessor   connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF         = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();

            try
            {
                dt = SF.SearchVHR("");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 45
0
        public void DeleteVehicle_NonExistent()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();

            Delete_Accessor d = new Delete_Accessor(connection.GetDB());

            try
            {
                d.DeleteVehicle(23452345);
            }
            catch (OleDbException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 46
0
        public void DeleteVehicle_Empty()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();

            Delete_Accessor d = new Delete_Accessor(connection.GetDB());

            try
            {
                d.DeleteVehicle(new int());
            }
            catch (OleDbException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 47
0
        public void DeletePart_NonExistent()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();

            Delete_Accessor d = new Delete_Accessor(connection.GetDB());

            try
            {
                d.DeletePart(10);
            }
            catch (OleDbException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 48
0
        public void DeleteVehicle_Empty()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();

            Delete_Accessor d = new Delete_Accessor(connection.GetDB());

            try
            {
                d.DeleteVehicle(new int());
            }
            catch (OleDbException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 49
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.º 50
0
        public void SearchVehicle_NormalPath()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();

            try
            {
                dt = SF.SearchVehicle("3");
            }
            catch (OleDbException ex)
            {
            }

            Assert.IsTrue(dt.Rows.Count == 1);
        }
Exemplo n.º 51
0
        public void SearchVHR_NormalPath()
        {
            DBConnection_Accessor   connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF         = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();

            try
            {
                dt = SF.SearchVHR("121");
            }
            catch (OleDbException ex)
            {
            }

            Assert.IsTrue(dt.Rows.Count == 1);
        }
Exemplo n.º 52
0
        public void SearchSale_EmptyEID()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();

            try
            {
                dt = SF.SearchSale("", "121", "3");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }
            Assert.IsTrue(dt.Rows.Count == 0);
        }
Exemplo n.º 53
0
        public void SearchVehicle_NonExistent()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();

            try
            {
                dt = SF.SearchVehicle("2");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 0);
        }
Exemplo n.º 54
0
        public void SearchName_NormalPath()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();

            try
            {
                dt = SF.SearchPersonName("hi there");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 1);
        }
Exemplo n.º 55
0
        public void AddEngine_DeleteInstance()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEngine_Accessor mc = new MakeEngine_Accessor("1", "", "", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "1", "", "", "", "", "" };

            MakePart_Accessor mp = new MakePart_Accessor(D, db.GetDB());
            try
            {
                d.DeletePart(1);
            }
            catch (Exception)
            {

            }
            mp.CreatePart();
            mc.CreateEngine();

            SearchFunction_Accessor SF = new SearchFunction_Accessor(db.GetDB());
            DataTable dt1 = new DataTable();
            DataTable dt2 = new DataTable();

            try
            {
                dt2 = SF.SearchPart("1");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            mc.DeleteEngine();
            mp.DeletePart();

            try
            {
                dt1 = SF.SearchPart("1");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt1.Rows.Count == 0 && dt2.Rows.Count == 1);
        }
Exemplo n.º 56
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.º 57
0
        public void AddCustomerControl_badIDValue()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            SearchFunction_Accessor sf = new SearchFunction_Accessor(db.GetDB());
            AddCustomerControl_Accessor aec = new AddCustomerControl_Accessor(db.GetDB());

            String[] D = new String[] { "abc", "", "", "", "", "abc", "Customer" };

            ErrorWindow ew = aec.createCustomer(D);
            DataTable dt = null;
            try
            {
                  dt = sf.SearchPersonID("abc");
            }
            catch (Exception e) { };
            Assert.IsTrue(dt.Rows.Count == 0);
            Assert.IsNotNull(ew);
        }
Exemplo n.º 58
0
        public void AddCustomer_BadIDFormat()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeCustomer_Accessor mc = new MakeCustomer_Accessor("abc", "", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "abc", "", "", "", "" };

            MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB());
            try
            {
                d.DeletePerson(1);
            }
            catch (Exception)
            {

            }
            mp.CreatePerson();
            mc.CreateCustomer();
        }
Exemplo n.º 59
0
        public void AddEmployee_BadManIDFormat()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("1114", "", "", "abc", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "1114", "", "", "", "" };

            MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB());
            try
            {
                d.DeletePerson(1114);
            }
            catch (Exception)
            {

            }
            mp.CreatePerson();
            mc.CreateEmployee();
        }
Exemplo n.º 60
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();
        }