added some missing cancellation tokens and fixed incorrect tests

This commit is contained in:
Sean Garrett
2023-06-16 22:40:46 +01:00
parent f09cfc53c2
commit 23780697fb
25 changed files with 1077 additions and 175 deletions
@@ -16,7 +16,7 @@ public class CreateAscendingIndexTests : BaseIndexTests
{
// Arrange
IndexHandler = new Mock<IMongoDbIndexHandler>();
var token = new CancellationToken();
var token = new CancellationToken(true);
// Act
Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;
@@ -26,4 +26,4 @@ public class CreateAscendingIndexTests : BaseIndexTests
IndexHandler.Verify(x => x.CreateAscendingIndexAsync<TestDocument, Guid>(
fieldExpression, null, null, token));
}*/
}
}
@@ -67,7 +67,7 @@ public class CreateTextIndexTests : BaseIndexTests
{
// Arrange
IndexHandler = new Mock<IMongoDbIndexHandler>();
var token = new CancellationToken();
var token = new CancellationToken(true);
// Act
await Sut.CreateTextIndexAsync<TestDocument>(_fieldExpression, token);
@@ -82,7 +82,7 @@ public class CreateTextIndexTests : BaseIndexTests
{
// Arrange
IndexHandler = new Mock<IMongoDbIndexHandler>();
var token = new CancellationToken();
var token = new CancellationToken(true);
var options = new IndexCreationOptions { Name = "theIndexName" };
// Act
@@ -99,7 +99,7 @@ public class CreateTextIndexTests : BaseIndexTests
{
// Arrange
const string partitionKey = "thePartitionKey";
var token = new CancellationToken();
var token = new CancellationToken(true);
IndexHandler = new Mock<IMongoDbIndexHandler>();
// Act
@@ -130,7 +130,7 @@ public class CreateTextIndexTests : BaseIndexTests
{
// Arrange
IndexHandler = new Mock<IMongoDbIndexHandler>();
var token = new CancellationToken();
var token = new CancellationToken(true);
// Act
await Sut.CreateTextIndexAsync<TestDocumentWithKey, int>(t => t.SomeContent2, token);
@@ -179,7 +179,7 @@ public class CreateTextIndexTests : BaseIndexTests
// Arrange
const string partitionKey = "thePartitionKey";
const string indexName = "theIndexName";
var token = new CancellationToken();
var token = new CancellationToken(true);
var options = new IndexCreationOptions { Name = indexName };
IndexHandler = new Mock<IMongoDbIndexHandler>();
@@ -192,4 +192,4 @@ public class CreateTextIndexTests : BaseIndexTests
t => t.SomeContent2, options, partitionKey, token));
}
*/
}
}
@@ -37,7 +37,7 @@ public class GetIndexNamesTests : BaseIndexTests
{
// Arrange
const string indexName = "theIndexName";
var token = new CancellationToken();
var token = new CancellationToken(true);
IndexHandler = new Mock<IMongoDbIndexHandler>();
IndexHandler
.Setup(x => x.GetIndexesNamesAsync<TestDocument, Guid>(null, token))
@@ -78,7 +78,7 @@ public class GetIndexNamesTests : BaseIndexTests
// Arrange
const string partitionKey = "thePartitionKey";
const string indexName = "theIndexName";
var token = new CancellationToken();
var token = new CancellationToken(true);
IndexHandler = new Mock<IMongoDbIndexHandler>();
IndexHandler
@@ -117,7 +117,7 @@ public class GetIndexNamesTests : BaseIndexTests
{
// Arrange
const string indexName = "theIndexName";
var token = new CancellationToken();
var token = new CancellationToken(true);
IndexHandler = new Mock<IMongoDbIndexHandler>();
IndexHandler
.Setup(x => x.GetIndexesNamesAsync<TestDocumentWithKey, int>(null, token))
@@ -157,7 +157,7 @@ public class GetIndexNamesTests : BaseIndexTests
// Arrange
const string indexName = "theIndexName";
const string partitionKey = "thePartitionKey";
var token = new CancellationToken();
var token = new CancellationToken(true);
IndexHandler = new Mock<IMongoDbIndexHandler>();
IndexHandler
@@ -171,4 +171,4 @@ public class GetIndexNamesTests : BaseIndexTests
Assert.NotNull(result);
Assert.Contains(result, x => x == indexName);
}*/
}
}