예제 #1
0
        public void NotOpenedConnection_ShouldBeOpened()
        {
            var cnn = new ReliableSqlConnection(
                Config.ConnectionString,
                new MockRetryStrategy(),
                new FixedInterval(1, TimeSpan.FromMilliseconds(0)));

            var command = cnn.CreateCommand();
            command.CommandText = "SELECT 1";

            if (cnn.State != ConnectionState.Closed)
                throw new Exception("It's necessary for the test to keep connection closed.");

            int resul = (int)command.ExecuteScalar();

            Assert.That(resul, Is.EqualTo(1));
        }
예제 #2
0
        public void NotOpenedConnection_ShouldBeOpened()
        {
            var cnn = new ReliableSqlConnection(
                Config.ConnectionString,
                new MockRetryStrategy(),
                new FixedInterval(1, TimeSpan.FromMilliseconds(0)));

            var command = cnn.CreateCommand();

            command.CommandText = "SELECT 1";

            if (cnn.State != ConnectionState.Closed)
            {
                throw new Exception("It's necessary for the test to keep connection closed.");
            }

            int resul = (int)command.ExecuteScalar();

            Assert.That(resul, Is.EqualTo(1));
        }