コード例 #1
0
        public void SearchID_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.SearchPersonID("2");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

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

            //Person.DeletePerson();
        }
コード例 #2
0
        public void SearchID_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.SearchPersonID("2");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }



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

            //Person.DeletePerson();
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
0
        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();
        }
コード例 #6
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);
        }
コード例 #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);
        }
コード例 #8
0
        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);
        }
コード例 #9
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);
        }
コード例 #10
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);
        }
コード例 #11
0
        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);
        }
コード例 #12
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);
        }
コード例 #13
0
        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();
        }
コード例 #14
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);
        }
コード例 #15
0
        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);
        }
コード例 #16
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);
        }
コード例 #17
0
        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);
        }
コード例 #18
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);
        }