예제 #1
0
        public void TestSimpleSelect()
        {
            MockSimpleObject criteria = new MockSimpleObject();

            criteria.Id = 5;
            OleDbConnection con = new OleDbConnection(connectString);

            //OracleConnection con = new OracleConnection(connectString);
            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao = new SimpleDAO.SimpleDAO <MockSimpleObject>(':');

            MockSimpleObject newObj = dao.SimpleSelect(con, criteria);

            Assert.AreEqual(newObj.Id, 5);
            newObj = null;

            Dictionary <string, string> props = new Dictionary <string, string>();

            props.Add("Id", null);
            props.Add("CommonName", null);
            props.Add("FullName", "FULL_NAME");
            newObj = dao.SimpleSelect(con, criteria, props);
            con.Close();
            Assert.AreEqual(newObj.Id, 5);
        }
예제 #2
0
        public void TestSimpleUpdate()
        {
            MockSimpleObject obj = new MockSimpleObject();

            string[] key = new string[] { "ID" };
            //obj.DBUpdateKey = key;
            obj.Id         = 99;
            obj.CommonName = "object1";
            obj.CreateDate = DateTime.Today;
            obj.FullName   = "Object One";
            obj.Status     = 1;
            OleDbConnection con = new OleDbConnection(connectString);

            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao   = new SimpleDAO.SimpleDAO <MockSimpleObject>();
            Dictionary <string, string>            props = new Dictionary <string, string>();

            props.Add("Id", "ID");
            props.Add("CommonName", "COMMON_NAME");
            props.Add("FullName", "FULL_NAME");
            props.Add("Status", "STATUS");
            dao.SimpleUpdate(con, obj); //, props);
            con.Close();
            Assert.Inconclusive("nothing to assert");
        }
예제 #3
0
        public void TestSimpleSelectWithSQL()
        {
            MockSimpleObject criteria = new MockSimpleObject();

            criteria.Id      = 5;
            criteria.DBTable = "SELECT * FROM MOCK_SIMPLE WHERE ID= @Id AND COMMON_NAME=@CommonName AND FULL_NAME =@FullName";
            //obj.DBTable = "SELECT * FROM SOME_TABLE WHERE ID= ? AND COMMON_NAME=? AND FULL_NAME =? AND COL3=?";
            OleDbConnection con = new OleDbConnection(connectString);

            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao = new SimpleDAO.SimpleDAO <MockSimpleObject>();
            MockSimpleObject newObj = dao.SimpleSelect(con, criteria);

            Assert.AreEqual(criteria.Id, newObj.Id);
            newObj = null;

            Dictionary <string, string> props = new Dictionary <string, string>();

            props.Add("Id", null);
            props.Add("CommonName", null);
            props.Add("FullName", "full_name");
            newObj = dao.SimpleSelect(con, criteria, props);
            con.Close();
            Assert.AreEqual(newObj.Id, 5);
            con.Close();
        }
예제 #4
0
 public void TestSimpleDelete()
 {
     MockSimpleObject obj = new MockSimpleObject();
     obj.Id = 99;
     //            SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=JPAS;User ID=jpas_user;Password=jpas2007");
     OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\SimpleDAO\SimpleDAOTest\SimpleDAO.mdb");
     con.Open();
     SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>();
     dao.NullStringValue = null;
     dao.NullIntValue = 0;
     dao.SimpleDelete(con, obj);
     con.Close();
 }
예제 #5
0
        public void TestSimpleDelete()
        {
            MockSimpleObject obj = new MockSimpleObject();

            obj.Id = 99;
//            SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=JPAS;User ID=jpas_user;Password=jpas2007");
            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\SimpleDAO\SimpleDAOTest\SimpleDAO.mdb");

            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao = new SimpleDAO.SimpleDAO <MockSimpleObject>();
            dao.NullStringValue = null;
            dao.NullIntValue    = 0;
            dao.SimpleDelete(con, obj);
            con.Close();
        }
예제 #6
0
        public void TestSimpleInsert()
        {
            MockSimpleObject obj = new MockSimpleObject();

            obj.CommonName = "testInsert";
            obj.CreateDate = DateTime.Today;
            obj.FullName   = "Test Insert";
            obj.Id         = 99;
            obj.Status     = 4;
            OleDbConnection con = new OleDbConnection(connectString);

            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao = new SimpleDAO.SimpleDAO <MockSimpleObject>();
            dao.SimpleInsert(con, obj);
            con.Close();
        }
예제 #7
0
        public void TestSimpleInsert()
        {
            MockSimpleObject obj = new MockSimpleObject();

            obj.CommonName = "testInsert";
            obj.CreateDate = DateTime.Today;
            obj.FullName   = "Test Insert";
            obj.Id         = 99;
            obj.Status     = 4;
            //SqlConnection con = new SqlConnection(@"Data Source=(local);Initial Catalog=JPAS;User ID=jpas_user;Password=jpas2007");
            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\SimpleDAO\SimpleDAOTest\SimpleDAO.mdb");

            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao = new SimpleDAO.SimpleDAO <MockSimpleObject>();
            dao.SimpleInsert(con, obj);
            con.Close();
        }
예제 #8
0
 public void TestSimpleDelete()
 {
     MockSimpleObject obj = new MockSimpleObject();
     obj.Id = 99;
     /*obj.CommonName = "testInsert";
     obj.CreateDate = DateTime.Today;
     obj.FullName = "Test Insert";
     obj.Status = 4;*/
     //SqlConnection con = new SqlConnection(connectString);
     OleDbConnection con = new OleDbConnection(connectString);
     con.Open();
     SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>();
     //dao.NullStringValue = null;
     //dao.NullIntValue = 0;
     //obj.CommonName = "testInsert";
     dao.SimpleDelete(con, obj);
     con.Close();
 }
예제 #9
0
        public void TestSimpleSelectList()
        {
            MockSimpleObject obj = new MockSimpleObject();

            //obj.DBOrderBy = new Dictionary<string, bool>();
            //obj.DBOrderBy.Add("Status", true);
            obj.Status = 1;
            //obj.CommonName = "cn10%";
            OleDbConnection con = new OleDbConnection(connectString);

            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao = new SimpleDAO.SimpleDAO <MockSimpleObject>();
            dao.NullStringValue = null;
            dao.NullIntValue    = 0;
            List <MockSimpleObject> list = dao.SimpleSelectList(con, obj);

            con.Close();
            Assert.IsTrue(list.Count == 3);
        }
예제 #10
0
        public void TestSimpleUpdate()
        {
            MockSimpleObject obj = new MockSimpleObject();

            string[] key = new string[] { "ID" };
            obj.DBUpdateKey = key;
            obj.Id          = 99;
            obj.CommonName  = "object1";
            obj.CreateDate  = DateTime.Now;
            obj.FullName    = "Object One";
            obj.Status      = 5;
//            SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=JPAS;User ID=jpas_user;Password=jpas2007");
            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\SimpleDAO\SimpleDAOTest\SimpleDAO.mdb");

            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao = new SimpleDAO.SimpleDAO <MockSimpleObject>();
            dao.SimpleUpdate(con, obj);
            con.Close();
        }
예제 #11
0
        public void TestSimpleSelectList()
        {
            MockSimpleObject obj = new MockSimpleObject();

            //obj.DBOrderBy = new Dictionary<string, bool>();
            //obj.DBOrderBy.Add("Status", true);
            obj.Status = 1;
            //obj.CommonName = "cn10%";
            //SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=JPAS;User ID=jpas_user;Password=jpas2007");
            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\SimpleDAO\SimpleDAOTest\SimpleDAO.mdb");

            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao = new SimpleDAO.SimpleDAO <MockSimpleObject>();
            dao.NullStringValue = null;
            dao.NullIntValue    = 0;
            List <MockSimpleObject> list = dao.SimpleSelectList(con, obj);

            con.Close();
            Assert.IsTrue(list.Count == 3);
        }
예제 #12
0
        public void TestSimpleDelete()
        {
            MockSimpleObject obj = new MockSimpleObject();

            obj.Id = 99;

            /*obj.CommonName = "testInsert";
             * obj.CreateDate = DateTime.Today;
             * obj.FullName = "Test Insert";
             * obj.Status = 4;*/
            //SqlConnection con = new SqlConnection(connectString);
            OleDbConnection con = new OleDbConnection(connectString);

            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao = new SimpleDAO.SimpleDAO <MockSimpleObject>();
            //dao.NullStringValue = null;
            //dao.NullIntValue = 0;
            //obj.CommonName = "testInsert";
            dao.SimpleDelete(con, obj);
            con.Close();
        }
예제 #13
0
        public void TestSimpleSelect()
        {
            MockSimpleObject            obj   = new MockSimpleObject();
            Dictionary <string, string> props = new Dictionary <string, string>();

            props.Add("Id", null);
            props.Add("CommonName", null);
            props.Add("FullName", "full_name");
            obj.CommonName = null;
            obj.Id         = 5;

            //obj.FullName = string.Empty;
            //SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=JPAS;User ID=jpas_user;Password=jpas2007");
            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\SimpleDAO\SimpleDAOTest\SimpleDAO.mdb");

            con.Open();
            SimpleDAO.SimpleDAO <MockSimpleObject> dao = new SimpleDAO.SimpleDAO <MockSimpleObject>();
            SimpleObject newObj = dao.SimpleSelect(con, obj, props);

            con.Close();
        }
예제 #14
0
 public void TestSimpleUpdate()
 {
     MockSimpleObject obj = new MockSimpleObject();
     string[] key = new string[] { "ID" };
     //obj.DBUpdateKey = key;
     obj.Id = 99;
     obj.CommonName = "object1";
     obj.CreateDate = DateTime.Today;
     obj.FullName = "Object One";
     obj.Status = 1;
     OleDbConnection con = new OleDbConnection(connectString);
     con.Open();
     SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>();
     Dictionary<string, string> props = new Dictionary<string, string>();
     props.Add("Id", "ID");
     props.Add("CommonName", "COMMON_NAME");
     props.Add("FullName", "FULL_NAME");
     props.Add("Status", "STATUS");
     dao.SimpleUpdate(con, obj); //, props);
     con.Close();
     Assert.Inconclusive("nothing to assert");
 }
예제 #15
0
        public void TestSimpleSelectWithSQL()
        {
            MockSimpleObject criteria = new MockSimpleObject();
            criteria.Id = 5;
            criteria.DBTable = "SELECT * FROM MOCK_SIMPLE WHERE ID= @Id AND COMMON_NAME=@CommonName AND FULL_NAME =@FullName";
            //obj.DBTable = "SELECT * FROM SOME_TABLE WHERE ID= ? AND COMMON_NAME=? AND FULL_NAME =? AND COL3=?";
            OleDbConnection con = new OleDbConnection(connectString);
            con.Open();
            SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>();
            MockSimpleObject newObj = dao.SimpleSelect(con, criteria);
            Assert.AreEqual(criteria.Id, newObj.Id);
            newObj = null;

            Dictionary<string, string> props = new Dictionary<string, string>();
            props.Add("Id", null);
            props.Add("CommonName", null);
            props.Add("FullName", "full_name");
            newObj = dao.SimpleSelect(con, criteria, props);
            con.Close();
            Assert.AreEqual(newObj.Id, 5);
            con.Close();
        }
예제 #16
0
        public void TestSimpleSelectList()
        {
            MockSimpleObject obj = new MockSimpleObject();
            //obj.DBOrderBy = new Dictionary<string, bool>();
            //obj.DBOrderBy.Add("Status", true);
            obj.Status = 1;
            //obj.CommonName = "cn10%";
            OleDbConnection con = new OleDbConnection(connectString);

            con.Open();
            SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>();
            dao.NullStringValue = null;
            dao.NullIntValue = 0;
            List<MockSimpleObject> list = dao.SimpleSelectList(con, obj);
            con.Close();
            Assert.IsTrue(list.Count == 3);
        }
예제 #17
0
        public void TestSimpleSelect()
        {
            MockSimpleObject criteria = new MockSimpleObject();
            criteria.Id = 5;
            OleDbConnection con = new OleDbConnection(connectString);
            //OracleConnection con = new OracleConnection(connectString);
            con.Open();
            SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>(':');

            MockSimpleObject newObj = dao.SimpleSelect(con, criteria);
            Assert.AreEqual(newObj.Id, 5);
            newObj = null;

            Dictionary<string, string> props = new Dictionary<string, string>();
            props.Add("Id", null);
            props.Add("CommonName", null);
            props.Add("FullName", "FULL_NAME");
            newObj = dao.SimpleSelect(con, criteria, props);
            con.Close();
            Assert.AreEqual(newObj.Id, 5);
        }
예제 #18
0
        public void TestSimpleSelect()
        {
            MockSimpleObject obj = new MockSimpleObject();
            Dictionary<string, string> props = new Dictionary<string, string>();
            props.Add("Id", null);
            props.Add("CommonName", null);
            props.Add("FullName", "full_name");
            obj.CommonName = null;
            obj.Id = 5;

            //obj.FullName = string.Empty;
            //SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=JPAS;User ID=jpas_user;Password=jpas2007");
            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\SimpleDAO\SimpleDAOTest\SimpleDAO.mdb");
            con.Open();
            SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>();
            SimpleObject newObj = dao.SimpleSelect(con, obj,props);
            con.Close();
        }
예제 #19
0
 public void TestSimpleInsert()
 {
     MockSimpleObject obj = new MockSimpleObject();
     obj.CommonName = "testInsert";
     obj.CreateDate = DateTime.Today;
     obj.FullName = "Test Insert";
     obj.Id = 99;
     obj.Status = 4;
     //SqlConnection con = new SqlConnection(@"Data Source=(local);Initial Catalog=JPAS;User ID=jpas_user;Password=jpas2007");
     OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\SimpleDAO\SimpleDAOTest\SimpleDAO.mdb");
     con.Open();
     SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>();
     dao.SimpleInsert(con, obj);
     con.Close();
 }
예제 #20
0
 public void TestSimpleUpdate()
 {
     MockSimpleObject obj = new MockSimpleObject();
     string[] key = new string[] { "ID" };
     obj.DBUpdateKey = key;
     obj.Id = 99;
     obj.CommonName = "object1";
     obj.CreateDate = DateTime.Now;
     obj.FullName = "Object One";
     obj.Status = 5;
     //            SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=JPAS;User ID=jpas_user;Password=jpas2007");
     OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\SimpleDAO\SimpleDAOTest\SimpleDAO.mdb");
     con.Open();
     SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>();
     dao.SimpleUpdate(con, obj);
     con.Close();
 }
예제 #21
0
 public void TestSimpleInsert()
 {
     MockSimpleObject obj = new MockSimpleObject();
     obj.CommonName = "testInsert";
     obj.CreateDate = DateTime.Today;
     obj.FullName = "Test Insert";
     obj.Id = 99;
     obj.Status = 4;
     OleDbConnection con = new OleDbConnection(connectString);
     con.Open();
     SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>();
     dao.SimpleInsert(con, obj);
     con.Close();
 }
예제 #22
0
        public void TestSimpleSelectList()
        {
            MockSimpleObject obj = new MockSimpleObject();
            //obj.DBOrderBy = new Dictionary<string, bool>();
            //obj.DBOrderBy.Add("Status", true);
            obj.Status = 1;
            //obj.CommonName = "cn10%";
            //SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=JPAS;User ID=jpas_user;Password=jpas2007");
            OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\SimpleDAO\SimpleDAOTest\SimpleDAO.mdb");

            con.Open();
            SimpleDAO.SimpleDAO<MockSimpleObject> dao = new SimpleDAO.SimpleDAO<MockSimpleObject>();
            dao.NullStringValue = null;
            dao.NullIntValue = 0;
            List<MockSimpleObject> list = dao.SimpleSelectList(con, obj);
            con.Close();
            Assert.IsTrue(list.Count == 3);
        }