public void ReliableSqlCommandProperties() { var command = new ReliableSqlConnection.ReliableSqlCommand(); command.CommandText = "SELECT 1"; Assert.Equal(command.CommandText, "SELECT 1"); Assert.NotNull(command.CommandTimeout); Assert.NotNull(command.CommandType); command.DesignTimeVisible = true; Assert.True(command.DesignTimeVisible); command.UpdatedRowSource = UpdateRowSource.None; Assert.Equal(command.UpdatedRowSource, UpdateRowSource.None); Assert.NotNull(command.GetUnderlyingCommand()); Assert.Throws <InvalidOperationException>(() => command.ValidateConnectionIsSet()); command.Prepare(); Assert.NotNull(command.CreateParameter()); command.Cancel(); }
public void InitReliableSqlConnectionTest() { ScriptFile scriptFile; ConnectionInfo connInfo = TestObjects.InitLiveConnectionInfo(out scriptFile); var connection = connInfo.SqlConnection as ReliableSqlConnection; var command = new ReliableSqlConnection.ReliableSqlCommand(connection); Assert.NotNull(command.Connection); var retryPolicy = connection.CommandRetryPolicy; connection.CommandRetryPolicy = retryPolicy; Assert.True(connection.CommandRetryPolicy == retryPolicy); connection.ChangeDatabase("master"); Assert.True(connection.ConnectionTimeout > 0); connection.ClearPool(); }
public void InitReliableSqlConnectionTest() { var result = LiveConnectionHelper.InitLiveConnectionInfo(); ConnectionInfo connInfo = result.ConnectionInfo; DbConnection dbConnection; connInfo.TryGetConnection(ConnectionType.Default, out dbConnection); var connection = dbConnection as ReliableSqlConnection; var command = new ReliableSqlConnection.ReliableSqlCommand(connection); Assert.NotNull(command.Connection); var retryPolicy = connection.CommandRetryPolicy; connection.CommandRetryPolicy = retryPolicy; Assert.True(connection.CommandRetryPolicy == retryPolicy); connection.ChangeDatabase("master"); Assert.True(connection.ConnectionTimeout > 0); connection.ClearPool(); }