MongodbReader cancellation tokens and some unit tests

This commit is contained in:
Sean Garrett
2023-06-25 15:03:52 +01:00
parent 11ce19cb5c
commit dee1376a41
22 changed files with 1758 additions and 614 deletions
@@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Threading;
using CoreUnitTests.Infrastructure;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Driver;
using MongoDbGenericRepository.DataAccess.Index;
using Moq;
@@ -41,5 +40,4 @@ public class BaseIndexTests : GenericTestContext<MongoDbIndexHandler>
return (asyncCursor, indexManager);
}
}
@@ -19,7 +19,7 @@ public class CreateAscendingIndexAsyncTests : BaseIndexTests
private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;
[Fact]
public async Task WhenFieldExpression_ThenCreatesIndex()
public async Task WithFieldExpression_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -42,7 +42,7 @@ public class CreateAscendingIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndOptions_ThenCreatesIndex()
public async Task WithFieldExpressionAndOptions_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -68,7 +68,7 @@ public class CreateAscendingIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndPartitionKey_ThenCreatesIndex()
public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -95,7 +95,7 @@ public class CreateAscendingIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndCancellationToken_ThenCreatesIndex()
public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -121,7 +121,7 @@ public class CreateAscendingIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_ThenCreatesIndex()
public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -29,7 +29,7 @@ public class CreateCombinedTextIndexAsyncTests : BaseIndexTests
=> this.testOutputHelper = testOutputHelper;
[Fact]
public async Task WhenFieldExpression_ThenCreatesIndex()
public async Task WithFieldExpression_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -52,7 +52,7 @@ public class CreateCombinedTextIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndOptions_ThenCreatesIndex()
public async Task WithFieldExpressionAndOptions_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -78,7 +78,7 @@ public class CreateCombinedTextIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndPartitionKey_ThenCreatesIndex()
public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -105,7 +105,7 @@ public class CreateCombinedTextIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndCancellationToken_ThenCreatesIndex()
public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -131,7 +131,7 @@ public class CreateCombinedTextIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_ThenCreatesIndex()
public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -19,7 +19,7 @@ public class CreateDescendingIndexAsyncTests : BaseIndexTests
private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;
[Fact]
public async Task WhenFieldExpression_ThenCreatesIndex()
public async Task WithFieldExpression_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -42,7 +42,7 @@ public class CreateDescendingIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndOptions_ThenCreatesIndex()
public async Task WithFieldExpressionAndOptions_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -68,7 +68,7 @@ public class CreateDescendingIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndPartitionKey_ThenCreatesIndex()
public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -95,7 +95,7 @@ public class CreateDescendingIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndCancellationToken_ThenCreatesIndex()
public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -121,7 +121,7 @@ public class CreateDescendingIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_ThenCreatesIndex()
public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -24,7 +24,7 @@ public class CreateHashedIndexAsyncTests : BaseIndexTests
=> this.testOutputHelper = testOutputHelper;
[Fact]
public async Task WhenFieldExpression_ThenCreatesIndex()
public async Task WithFieldExpression_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -47,7 +47,7 @@ public class CreateHashedIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndOptions_ThenCreatesIndex()
public async Task WithFieldExpressionAndOptions_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -73,7 +73,7 @@ public class CreateHashedIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndPartitionKey_ThenCreatesIndex()
public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -100,7 +100,7 @@ public class CreateHashedIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndCancellationToken_ThenCreatesIndex()
public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -126,7 +126,7 @@ public class CreateHashedIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_ThenCreatesIndex()
public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -19,7 +19,7 @@ public class CreateTextIndexAsyncTests : BaseIndexTests
private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;
[Fact]
public async Task WhenFieldExpression_ThenCreatesIndex()
public async Task WithFieldExpression_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -42,7 +42,7 @@ public class CreateTextIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndOptions_ThenCreatesIndex()
public async Task WithFieldExpressionAndOptions_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -68,7 +68,7 @@ public class CreateTextIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndPartitionKey_ThenCreatesIndex()
public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -95,7 +95,7 @@ public class CreateTextIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndCancellationToken_ThenCreatesIndex()
public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -121,7 +121,7 @@ public class CreateTextIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_ThenCreatesIndex()
public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -13,7 +13,7 @@ namespace CoreUnitTests.DataAccessTests.MongoDbIndexHandlerTests;
public class DropIndexAsyncTests : BaseIndexTests
{
[Fact]
public async Task WhenIndexName_ThenDropsIndex()
public async Task WithIndexName_DropsIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -30,7 +30,7 @@ public class DropIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenIndexNameAndPartitionKey_ThenDropsIndex()
public async Task WithIndexNameAndPartitionKey_DropsIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -50,7 +50,7 @@ public class DropIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenIndexNameAndCancellationToken_ThenDropsIndex()
public async Task WithIndexNameAndCancellationToken_DropsIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();
@@ -69,7 +69,7 @@ public class DropIndexAsyncTests : BaseIndexTests
}
[Fact]
public async Task WhenIndexNameAndPartitionKeyAndCancellationToken_ThenDropsIndex()
public async Task WithIndexNameAndPartitionKeyAndCancellationToken_DropsIndex()
{
// Arrange
var expectedIndexName = Fixture.Create<string>();