Example #1
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");
        }
        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);
        }
        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);
        }
        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);
        }
        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();
        }
        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();
        }
        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();
        }
        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);
        }
        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);
        }
        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);
        }
Example #11
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);
 }
Example #12
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);
        }
        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;
            }
        }
Example #14
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;
            }
        }
Example #15
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);
        }
Example #16
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);
        }
        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);
        }
        public void AddEmployee_DeleteInstance()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("21113", "", "", "", db.GetDB());
            Delete_Accessor       d  = new Delete_Accessor(db.GetDB());

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

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

            try
            {
                d.DeletePerson(21113);
            }
            catch (Exception)
            {
            }
            mp.CreatePerson();
            mc.CreateEmployee();

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

            try
            {
                dt2 = SF.SearchPersonID("21113");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            mc.DeleteEmployee();
            mp.DeletePerson();

            try
            {
                dt1 = SF.SearchPersonID("21113");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt1.Rows.Count == 0 && dt2.Rows.Count == 1);
        }
Example #19
0
        public void AddTires_DeleteInstance()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeTires_Accessor    mc = new MakeTires_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.CreateTires();

            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.DeleteTires();
            mp.DeletePart();

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

            Assert.IsTrue(dt1.Rows.Count == 0 && dt2.Rows.Count == 1);
        }
        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);
        }
Example #21
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);
        }
Example #22
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);
        }
Example #23
0
        public void SearchPart_NonExistent()
        {
            DBConnection_Accessor   connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF         = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();

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

            Assert.IsTrue(dt.Rows.Count == 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);
        }
        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);
        }
        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);
        }
        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);
        }
        public void AddEmployeeControl_create()
        {
            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());

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

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

            Assert.IsTrue(dt.Rows.Count == 1);
        }
        public void AddEmployeeControl_badManagerID()
        {
            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());

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

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

            Assert.IsTrue(dt.Rows.Count == 0);
            Assert.IsNotNull(ew);
        }
        public void SearchID_EmptyID()
        {
            //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("");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            //Person.DeletePerson();
        }
        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);
        }
Example #32
0
        public void DeleteVehicle_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.DeleteVehicle(1);
            }
            catch (Exception e)
            {
            }
            String[] D = new String[] { "1", "1", "1", "1", "1", "1" };

            MakeVehicle_Accessor veh = new MakeVehicle_Accessor(D, connection.GetDB());

            veh.CreateVehicle();
            MakeCar_Accessor car = new MakeCar_Accessor("1", "smart car", connection.GetDB());

            car.CreateCar();

            d.DeleteVehicle(1);

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

            Assert.IsTrue(dt.Rows.Count == 0);
        }
        public void DeleteVehicle_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.DeleteVehicle(1);
            }
            catch (Exception e)
            {
            }
            String[] D = new String[] { "1", "1", "1", "1", "1", "1" };

            MakeVehicle_Accessor veh = new MakeVehicle_Accessor(D, connection.GetDB());
            veh.CreateVehicle();
            MakeCar_Accessor car = new MakeCar_Accessor("1", "smart car", connection.GetDB());
            car.CreateCar();

            d.DeleteVehicle(1);

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

            Assert.IsTrue(dt.Rows.Count == 0);
        }
        public void AddEmployeeControl_badManagerID()
        {
            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());

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

            try
            {
                d.DeletePerson(10011);
            }
            catch (Exception)
            {

            }
            ErrorWindow ew = aec.createEmployee(D);
            DataTable dt = sf.SearchPersonID("10011");
            Assert.IsTrue(dt.Rows.Count == 0);
            Assert.IsNotNull(ew);
        }
        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);
        }
        public void AddEmployeeControl_createDuplicate()
        {
            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());

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

            try
            {
                d.DeletePerson(10011);
            }
            catch (Exception)
            {

            }
            aec.createEmployee(D);
            ErrorWindow ew = aec.createEmployee(D);
            DataTable dt = sf.SearchPersonID("10011");
            Assert.IsTrue(dt.Rows.Count == 1);
            Assert.IsNotNull(ew);
        }
Example #37
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");
        }