-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Particular/testablestoragesession
Introduce TestableSynchronizedStorageSession
- Loading branch information
Showing
5 changed files
with
45 additions
and
2 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
9 changes: 9 additions & 0 deletions
9
src/NServiceBus.Storage.MongoDB/SynchronizedStorage/IMongoSessionProvider.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,9 @@ | ||
namespace NServiceBus.Storage.MongoDB | ||
{ | ||
using global::MongoDB.Driver; | ||
|
||
interface IMongoSessionProvider | ||
{ | ||
IClientSessionHandle MongoSession { get; } | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
src/NServiceBus.Storage.MongoDB/Testing/TestableMongoSynchronizedStorageSession.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,26 @@ | ||
namespace NServiceBus.Testing | ||
{ | ||
using MongoDB.Driver; | ||
using Persistence; | ||
using Storage.MongoDB; | ||
|
||
/// <summary> | ||
/// A fake implementation for <see cref="SynchronizedStorageSession"/> for testing purposes. | ||
/// </summary> | ||
public class TestableMongoSynchronizedStorageSession : SynchronizedStorageSession, IMongoSessionProvider | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of <see cref="TestableMongoSynchronizedStorageSession"/> using the provided <see cref="IClientSessionHandle"/>. | ||
/// </summary> | ||
/// <param name="clientSessionHandle"></param> | ||
public TestableMongoSynchronizedStorageSession(IClientSessionHandle clientSessionHandle) | ||
{ | ||
MongoSession = clientSessionHandle; | ||
} | ||
|
||
/// <summary> | ||
/// The client session handle which is retrieved by calling <see cref="SynchronizedStorageSessionExtensions.GetClientSession"/>. | ||
/// </summary> | ||
public IClientSessionHandle MongoSession { get; } | ||
} | ||
} |