-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use a transaction when merging words to ensure changes are either all…
… made or not.
- Loading branch information
Showing
4 changed files
with
50 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using BackendFramework.Interfaces; | ||
using MongoDB.Driver; | ||
|
||
namespace Backend.Tests.Mocks; | ||
|
||
public class MongoDbContextMock: IMongoDbContext | ||
{ | ||
public IMongoDatabase Db => throw new NotSupportedException(); | ||
public Task<IMongoTransaction> BeginTransaction() | ||
{ | ||
return Task.FromResult<IMongoTransaction>(new MongoTransactionMock()); | ||
} | ||
|
||
private sealed class MongoTransactionMock : IMongoTransaction | ||
{ | ||
public Task CommitTransactionAsync() | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
public Task AbortTransactionAsync() | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
} | ||
} | ||
} |
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