-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Unit Test for OutboxTableConfig overriding support. Enhanced Outb…
…oxTableConfig class properties to be virtual for easier overriding.
- Loading branch information
1 parent
7a4bbf1
commit b11d6e4
Showing
3 changed files
with
63 additions
and
10 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
18 changes: 18 additions & 0 deletions
18
SqlTransactionalOutbox.IntegrationTests/ConfigurationTests/CustomOutboxTableConfig.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,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SqlTransactionalOutbox.IntegrationTests.ConfigurationTests | ||
{ | ||
public class CustomSchemaNameOutboxTableConfig : OutboxTableConfig, ISqlTransactionalOutboxTableConfig | ||
{ | ||
public CustomSchemaNameOutboxTableConfig(string customOutboxSchemaName) | ||
{ | ||
TransactionalOutboxSchemaName = customOutboxSchemaName; | ||
} | ||
|
||
public new string TransactionalOutboxSchemaName { get; } | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
SqlTransactionalOutbox.IntegrationTests/ConfigurationTests/OutboxTableConfigTests.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 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using SqlTransactionalOutbox.IntegrationTests.ConfigurationTests; | ||
|
||
namespace SqlTransactionalOutbox.IntegrationTests | ||
{ | ||
[TestClass] | ||
public class OutboxTableConfigTests | ||
{ | ||
public TestContext TestContext { get; set; } | ||
|
||
[TestMethod] | ||
public void TestCustomOutboxTableConfigOverrides() | ||
{ | ||
const string CustomSchemaName = "sqloutbox"; | ||
var defaultTableConfig = new OutboxTableConfig(); | ||
var customSchemaTableConfig = new CustomSchemaNameOutboxTableConfig(CustomSchemaName); | ||
|
||
//Validate Class references | ||
Assert.AreEqual(CustomSchemaName, customSchemaTableConfig.TransactionalOutboxSchemaName); | ||
Assert.AreEqual(OutboxTableConfig.DefaultTransactionalOutboxSchemaName, defaultTableConfig.TransactionalOutboxSchemaName); | ||
Assert.AreNotEqual(defaultTableConfig.TransactionalOutboxSchemaName, customSchemaTableConfig.TransactionalOutboxSchemaName); | ||
Assert.AreEqual(defaultTableConfig.TransactionalOutboxTableName, customSchemaTableConfig.TransactionalOutboxTableName); | ||
|
||
//Validate Interface Cast references | ||
|
||
var defaultTableConfigAsInterface = (ISqlTransactionalOutboxTableConfig)defaultTableConfig; | ||
var customOutboxTableConfigAsInterface = (ISqlTransactionalOutboxTableConfig)customSchemaTableConfig; | ||
Assert.AreEqual(CustomSchemaName, customOutboxTableConfigAsInterface.TransactionalOutboxSchemaName); | ||
Assert.AreEqual(OutboxTableConfig.DefaultTransactionalOutboxSchemaName, defaultTableConfigAsInterface.TransactionalOutboxSchemaName); | ||
Assert.AreNotEqual(defaultTableConfigAsInterface.TransactionalOutboxSchemaName, customOutboxTableConfigAsInterface.TransactionalOutboxSchemaName); | ||
Assert.AreEqual(defaultTableConfigAsInterface.TransactionalOutboxTableName, customOutboxTableConfigAsInterface.TransactionalOutboxTableName); | ||
} | ||
} | ||
} |