Exemplo n.º 1
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.º 2
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.º 3
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.º 4
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.º 5
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);
        }
Exemplo n.º 6
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.º 7
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.º 8
0
        public void AddCustomer_OnlyID()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeCustomer_Accessor mc = new MakeCustomer_Accessor("1", "", db.GetDB());
            Delete_Accessor       d  = new Delete_Accessor(db.GetDB());

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

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

            try
            {
                d.DeletePerson(1);
            }
            catch (Exception)
            {
            }
            mp.CreatePerson();
            mc.CreateCustomer();
        }
Exemplo n.º 9
0
        public void AddCustomer_NormalPath()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeCustomer_Accessor mc = new MakeCustomer_Accessor("1", "test", db.GetDB());
            Delete_Accessor       d  = new Delete_Accessor(db.GetDB());

            String[] D = new String[] { "1", "Sean", "5555555555", "calgary", "F" };

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

            try
            {
                d.DeletePerson(1);
            }
            catch (Exception)
            {
            }
            mp.CreatePerson();
            mc.CreateCustomer();
        }
Exemplo n.º 10
0
        public void AddCustomer_BadPhoneLength()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeCustomer_Accessor mc = new MakeCustomer_Accessor("1113", "", db.GetDB());
            Delete_Accessor       d  = new Delete_Accessor(db.GetDB());

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

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

            try
            {
                d.DeletePerson(1113);
            }
            catch (Exception)
            {
            }
            mp.CreatePerson();
            mc.CreateCustomer();
        }
Exemplo n.º 11
0
        public void AddEmployee_OverFlowSalary()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("1113", "10000000", "", "", db.GetDB());
            Delete_Accessor       d  = new Delete_Accessor(db.GetDB());

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

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

            try
            {
                d.DeletePerson(1113);
            }
            catch (Exception)
            {
            }
            mp.CreatePerson();
            mc.CreateEmployee();
        }
Exemplo n.º 12
0
        public void AddEmployee_NormalPath()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("1", "123", "1/1/1", "", db.GetDB());
            Delete_Accessor       d  = new Delete_Accessor(db.GetDB());

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

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

            try
            {
                d.DeletePerson(1);
            }
            catch (Exception)
            {
            }
            mp.CreatePerson();
            mc.CreateEmployee();
        }
Exemplo n.º 13
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.º 14
0
        public void AddEmployee_NegativeID()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("-5", "", "", "", db.GetDB());
            Delete_Accessor       d  = new Delete_Accessor(db.GetDB());

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

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

            try
            {
                d.DeletePerson(-5);
            }
            catch (Exception)
            {
            }
            mp.CreatePerson();
            mc.CreateEmployee();
        }
Exemplo n.º 15
0
        public void AddEmployee_BadPhoneChars()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("1113", "", "", "", db.GetDB());
            Delete_Accessor       d  = new Delete_Accessor(db.GetDB());

            String[] D = new String[] { "1113", "", "123456789b", "", "" };

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

            try
            {
                d.DeletePerson(1113);
            }
            catch (Exception)
            {
            }
            mp.CreatePerson();
            mc.CreateEmployee();
        }
Exemplo n.º 16
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.º 17
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);
        }
Exemplo n.º 18
0
        public void AddCustomer_BadPhoneLength()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeCustomer_Accessor mc = new MakeCustomer_Accessor("1", "", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "1", "", "12345678901", "", "" };

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

            }
            mp.CreatePerson();
            mc.CreateCustomer();
        }
Exemplo n.º 19
0
        public void AddCustomer_DuplicateID()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeCustomer_Accessor mc = new MakeCustomer_Accessor("1", "test", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "1", "Sean", "5555555555", "calgary", "M" };

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

            }
            mp.CreatePerson();
            mc.CreateCustomer();
            mp.CreatePerson();
            mc.CreateCustomer();
        }
Exemplo n.º 20
0
        public void AddEmployee_OverFlowSalary()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("1113", "10000000", "", "", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "1113", "", "", "", "" };

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

            }
            mp.CreatePerson();
            mc.CreateEmployee();
        }
Exemplo n.º 21
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.º 22
0
        public void AddEmployee_NormalPath()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("1", "123", "1/1/1", "", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "1", "Sean", "5555555555", "calgary", "M" };

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

            }
            mp.CreatePerson();
            mc.CreateEmployee();
        }
Exemplo n.º 23
0
        public void AddEmployee_BadPhoneChars()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("1113", "", "", "", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "1113", "", "123456789b", "", "" };

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

            }
            mp.CreatePerson();
            mc.CreateEmployee();
        }
Exemplo n.º 24
0
        public void AddEmployee_NegativeID()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEmployee_Accessor mc = new MakeEmployee_Accessor("-5", "", "", "", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "-5", "", "", "", "" };

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

            }
            mp.CreatePerson();
            mc.CreateEmployee();
        }
Exemplo n.º 25
0
        public void AddCustomer_NullCIDValue()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeCustomer_Accessor mc = new MakeCustomer_Accessor("", "", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "1113", "", "", "", "" };

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

            }
            mp.CreatePerson();
            mc.CreateCustomer();
        }