コード例 #1
0
        public void CreateOleDbConnection()
        {
            IDataService  service    = new OleDbDataService();
            IDbConnection connection = service.CreateConnection(OleDbConnection);

            Assert.IsNotNull(connection);
            Assert.IsInstanceOfType(connection, typeof(OleDbConnection));
            Assert.AreEqual(OleDbConnection, connection.ConnectionString);
        }
コード例 #2
0
        public void CreateOleDbSPCommand()
        {
            IDataService  service    = new OleDbDataService();
            IDbConnection connection = service.CreateConnection(OleDbConnection);
            IDbCommand    command    = service.CreateSPCommand(SPName, connection);

            Assert.IsNotNull(command);
            Assert.IsInstanceOfType(command, typeof(OleDbCommand));
            Assert.AreEqual(SPName, command.CommandText);
            Assert.AreEqual(CommandType.StoredProcedure, command.CommandType);
        }
コード例 #3
0
        public void CreateOleDbTextCommand()
        {
            IDataService  service    = new OleDbDataService();
            IDbConnection connection = service.CreateConnection(OleDbConnection);
            IDbCommand    command    = service.CreateTextCommand(SelectText, connection);

            Assert.IsNotNull(command);
            Assert.IsInstanceOfType(command, typeof(OleDbCommand));
            Assert.AreEqual(SelectText, command.CommandText);
            Assert.AreEqual(CommandType.Text, command.CommandType);
        }
コード例 #4
0
        public void CreateOleDbOutputParameter()
        {
            IDataService     service    = new OleDbDataService();
            IDbConnection    connection = service.CreateConnection(OleDbConnection);
            IDbDataParameter parameter  = service.CreateOutputParameter("Id", 1);

            Assert.IsNotNull(parameter);
            Assert.IsInstanceOfType(parameter, typeof(OleDbParameter));
            Assert.AreEqual("@Id", parameter.ParameterName);
            Assert.AreEqual(1, parameter.Value);
            Assert.AreEqual(ParameterDirection.Output, parameter.Direction);
        }