Exemplo n.º 1
0
        public DbCommandUtilTest()
        {
            var comm = new DbCommandUtil("IF NOT EXISTS(SELECT * FROM SYS.OBJECTS WHERE Name = 'Test') CREATE TABLE TEST (ID INT, VALUE NUMERIC(4,2))");

            Assert.Equal(ConnectionState.Closed, comm.DaScopeContext.Connection.State);
            comm.ExecuteNonQuery();
            Assert.Equal(ConnectionState.Closed, comm.DaScopeContext.Connection.State);
        }
Exemplo n.º 2
0
        private static void Insert()
        {
            // INSERT 1
            var insert1Comm = new DbCommandUtil("INSERT INTO TEST(ID,VALUE) VALUES(2, 1.2)");

            Assert.Equal(ConnectionState.Closed, insert1Comm.DaScopeContext.Connection.State);
            insert1Comm.ExecuteNonQuery();
            Assert.Equal(ConnectionState.Closed, insert1Comm.DaScopeContext.Connection.State);
            // INSERT 2
            var insert2Comm = new DbCommandUtil("INSERT INTO TEST(ID,VALUE) VALUES(3, 35.4)");

            Assert.Equal(ConnectionState.Closed, insert2Comm.DaScopeContext.Connection.State);
            insert2Comm.ExecuteNonQuery();
            Assert.Equal(ConnectionState.Closed, insert2Comm.DaScopeContext.Connection.State);
        }