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);
        }
        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();
        }
        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();
        }
        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();
        }
        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);
        }
Beispiel #6
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();
        }