ExecuteScript() публичный Метод

Executes a SQL script. Includes support for executing scripts in batches using the GO keyword.
public ExecuteScript ( DbTransaction tran, string script ) : void
tran System.Data.Common.DbTransaction
script string
Результат void
        public void ExecuteScript_should_use_CommandTimeout_specified_in_the_connection_string()
        {
            // arrange
            _subject = DataAccessFactory.Create(TestConnectionString + ";CommandTimeout=1");

            // act
            _subject.OpenConnection();
            using (var tran = _subject.BeginTransaction())
            {
                try
                {
                    _subject.ExecuteScript(tran, "WaitFor Delay '00:00:01'");
                }
                catch(Exception ex)
                {
                    // assert

                    // Sql Server Compact (which is being used for these tests) does not
                    // support CommandTimeout values other than 0. So we will assume
                    // that if it barfs it is because our non-zero CommandTimeout was successfully (attempted to be) set.
                    Assert.IsInstanceOfType(typeof (ArgumentException), ex);
                    Assert.AreEqual("SqlCeCommand.CommandTimeout does not support non-zero values.", ex.Message);
                    return;
                }
            }

            Assert.Fail("Expected command timeout exception to be thrown.");
        }