/// <summary> /// Initializes a new instance of the <see cref="SqlServerMessageQueueSchema"/> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> /// <param name="options">The options.</param> public SqlServerMessageQueueSchema(TableNameHelper tableNameHelper, ISqlServerMessageQueueTransportOptionsFactory options) { Guard.NotNull(() => tableNameHelper, tableNameHelper); Guard.NotNull(() => options, options); _tableNameHelper = tableNameHelper; _options = new Lazy<SqlServerMessageQueueTransportOptions>(options.Create); }
public static void SetError(string queueName, string connectionString) { var connection = new SqlConnectionInformation(queueName, connectionString); var helper = new TableNameHelper(connection); using (var conn = new SqlConnection(connectionString)) { conn.Open(); using (var command = conn.CreateCommand()) { command.CommandText = $"update {helper.StatusName} set status = 2"; command.ExecuteNonQuery(); } } }
public static void Verify(string queueName, string connectionString, long messageCount) { var connection = new SqlConnectionInformation(queueName, connectionString); var helper = new TableNameHelper(connection); using (var conn = new SqlConnection(connectionString)) { conn.Open(); using (var command = conn.CreateCommand()) { command.CommandText = $"select count(*) from {helper.StatusName}"; using (var reader = command.ExecuteReader()) { Assert.True(reader.Read()); var records = reader.GetInt32(0); Assert.Equal(messageCount, records); } } } }
/// <summary> /// Initializes a new instance of the <see cref="SqlServerMessageQueueCreation" /> class. /// </summary> /// <param name="queryTableExists">The query table exists.</param> /// <param name="createSchema">The create schema.</param> /// <param name="createCommand">The create command.</param> /// <param name="connectionInfo">The connection information.</param> /// <param name="tableNameHelper">The table name helper.</param> public SqlServerJobTableCreation(IQueryHandler<GetTableExistsQuery, bool> queryTableExists, SqlServerJobSchema createSchema, ICommandHandlerWithOutput<CreateJobTablesCommand, QueueCreationResult> createCommand, IConnectionInformation connectionInfo, TableNameHelper tableNameHelper ) { Guard.NotNull(() => createSchema, createSchema); Guard.NotNull(() => queryTableExists, queryTableExists); Guard.NotNull(() => createCommand, createCommand); Guard.NotNull(() => connectionInfo, connectionInfo); Guard.NotNull(() => tableNameHelper, tableNameHelper); _createSchema = createSchema; _queryTableExists = queryTableExists; _createCommand = createCommand; _connection = connectionInfo; _tableNameHelper = tableNameHelper; }
private SqlServerMessageQueueSchema Create(ISqlServerMessageQueueTransportOptionsFactory options, TableNameHelper tableNameHelper) { return new SqlServerMessageQueueSchema(tableNameHelper, options); }
public VerifyQueueData(string queueName, SqlServerMessageQueueTransportOptions options) { _options = options; _connection = new SqlConnectionInformation(queueName, ConnectionInfo.ConnectionString); _tableNameHelper = new TableNameHelper(_connection); }
public VerifyErrorCounts(string queueName) { _connection = new SqlConnectionInformation(queueName, ConnectionInfo.ConnectionString); _tableNameHelper = new TableNameHelper(_connection); }
/// <summary> /// Initializes a new instance of the <see cref="SqlServerJobSchema"/> class. /// </summary> /// <param name="tableNameHelper">The table name helper.</param> public SqlServerJobSchema(TableNameHelper tableNameHelper) { _tableNameHelper = tableNameHelper; }