-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Adjust the tests to verify before and after transactional session commit behavior * Fix TransactionScopeSqlOutboxTransaction to complete the scope on commit * Remove unnecessary method which was no longer called * Remove no longer used dispose callback * Async variants
- Loading branch information
1 parent
52b8cee
commit a8adf48
Showing
17 changed files
with
653 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/TransactionalSession.MsSqlMicrosoftDataClient.AcceptanceTests/OutboxHelpers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace NServiceBus.TransactionalSession.AcceptanceTests | ||
{ | ||
using System.Threading.Tasks; | ||
using AcceptanceTesting.Customization; | ||
using Microsoft.Data.SqlClient; | ||
using Persistence.Sql.ScriptBuilder; | ||
|
||
static class OutboxHelpers | ||
{ | ||
public static async Task CreateOutboxTable<TEndpoint>() | ||
=> await CreateOutboxTable(Conventions.EndpointNamingConvention(typeof(TEndpoint))); | ||
|
||
public static async Task CreateOutboxTable(string endpointName) | ||
{ | ||
string tablePrefix = TestTableNameCleaner.Clean(endpointName); | ||
using var connection = MsSqlMicrosoftDataClientConnectionBuilder.Build(); | ||
await connection.OpenAsync().ConfigureAwait(false); | ||
|
||
connection.ExecuteCommand(OutboxScriptBuilder.BuildDropScript(BuildSqlDialect.MsSqlServer), tablePrefix); | ||
connection.ExecuteCommand(OutboxScriptBuilder.BuildCreateScript(BuildSqlDialect.MsSqlServer), tablePrefix); | ||
} | ||
|
||
public static async Task CreateDataTable() | ||
{ | ||
var createTable = @"IF NOT EXISTS (SELECT * FROM sysobjects WHERE name='SomeTable' and xtype='U') | ||
BEGIN | ||
CREATE TABLE [dbo].[SomeTable]([Id] [nvarchar](50) NOT NULL) | ||
END;"; | ||
using var connection = MsSqlMicrosoftDataClientConnectionBuilder.Build(); | ||
await connection.OpenAsync(); | ||
using var createTableCommand = new SqlCommand(createTable, connection); | ||
await createTableCommand.ExecuteNonQueryAsync(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.