keyed Delete unit tests
This commit is contained in:
@@ -3,8 +3,6 @@ using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CoreUnitTests.Infrastructure.Model;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using MongoDbGenericRepository.DataAccess.Index;
|
||||
using MongoDbGenericRepository.Models;
|
||||
using Moq;
|
||||
@@ -21,7 +19,7 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
|
||||
// Act
|
||||
await Sut.CreateTextIndexAsync<TestDocument>(_fieldExpression);
|
||||
|
||||
@@ -29,14 +27,14 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateTextIndexAsync<TestDocument, Guid>(_fieldExpression, null, null));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Ensure_Passes_Options()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
var options = new IndexCreationOptions { Name = "theIndexName" };
|
||||
|
||||
|
||||
// Act
|
||||
await Sut.CreateTextIndexAsync<TestDocument>(_fieldExpression, options);
|
||||
|
||||
@@ -45,7 +43,7 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
x => x.CreateTextIndexAsync<TestDocument, Guid>(
|
||||
_fieldExpression, options, null));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Ensure_Passes_PartitionKey()
|
||||
{
|
||||
@@ -53,7 +51,7 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
const string partitionKey = "thePartitionKey";
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
|
||||
// Act
|
||||
await Sut.CreateTextIndexAsync<TestDocument>(_fieldExpression, partitionKey: partitionKey);
|
||||
|
||||
@@ -62,14 +60,15 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
x => x.CreateTextIndexAsync<TestDocument, Guid>(
|
||||
_fieldExpression, null, partitionKey));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
[Fact]
|
||||
public async Task Ensure_Creates_Index_With_CancellationToken()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
var token = new CancellationToken();
|
||||
|
||||
|
||||
// Act
|
||||
await Sut.CreateTextIndexAsync<TestDocument>(_fieldExpression, token);
|
||||
|
||||
@@ -77,7 +76,7 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateTextIndexAsync<TestDocument, Guid>(_fieldExpression, null, null, token));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Ensure_Passes_Options_With_CancellationToken()
|
||||
{
|
||||
@@ -85,7 +84,7 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
var token = new CancellationToken();
|
||||
var options = new IndexCreationOptions { Name = "theIndexName" };
|
||||
|
||||
|
||||
// Act
|
||||
await Sut.CreateTextIndexAsync<TestDocument>(_fieldExpression, token, options);
|
||||
|
||||
@@ -94,7 +93,7 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
x => x.CreateTextIndexAsync<TestDocument, Guid>(
|
||||
_fieldExpression, options, null, token));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Ensure_Passes_PartitionKey_With_CancellationToken()
|
||||
{
|
||||
@@ -102,7 +101,7 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
const string partitionKey = "thePartitionKey";
|
||||
var token = new CancellationToken();
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
|
||||
// Act
|
||||
await Sut.CreateTextIndexAsync<TestDocument>(_fieldExpression, token, partitionKey: partitionKey);
|
||||
|
||||
@@ -118,21 +117,21 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
Expression<Func<TestDocumentWithKey, object>> fieldExpression = t => t.SomeContent2;
|
||||
|
||||
|
||||
// Act
|
||||
await Sut.CreateTextIndexAsync<TestDocumentWithKey, int>(fieldExpression);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(x => x.CreateTextIndexAsync<TestDocumentWithKey, int>(fieldExpression, null, null, default));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Ensure_Passes_CancellationToken_Custom_Key()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
var token = new CancellationToken();
|
||||
|
||||
|
||||
// Act
|
||||
await Sut.CreateTextIndexAsync<TestDocumentWithKey, int>(t => t.SomeContent2, token);
|
||||
|
||||
@@ -141,21 +140,21 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
x => x.CreateTextIndexAsync<TestDocumentWithKey, int>(
|
||||
t => t.SomeContent2, null, null, token));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Ensure_Passes_Options_Custom_Key()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
var options = new IndexCreationOptions { Name = "theIndexName" };
|
||||
|
||||
|
||||
// Act
|
||||
await Sut.CreateTextIndexAsync<TestDocumentWithKey, int>(t => t.SomeContent2, options);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(x => x.CreateTextIndexAsync<TestDocumentWithKey, int>(t => t.SomeContent2, options, null, default));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Ensure_Passes_PartitionKey_Custom_Key()
|
||||
{
|
||||
@@ -173,7 +172,7 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
x => x.CreateTextIndexAsync<TestDocumentWithKey, int>(
|
||||
t => t.SomeContent2, options, partitionKey, default));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task Ensure_Passes_PartitionKey_And_CancellationToken_Custom_Key()
|
||||
{
|
||||
@@ -183,7 +182,7 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
var token = new CancellationToken();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
|
||||
// Act
|
||||
await Sut.CreateTextIndexAsync<TestDocumentWithKey, int>(t => t.SomeContent2, token, options, partitionKey);
|
||||
|
||||
@@ -192,4 +191,5 @@ public class CreateTextIndexTests : BaseIndexTests
|
||||
.Verify(x => x.CreateTextIndexAsync<TestDocumentWithKey, int>(
|
||||
t => t.SomeContent2, options, partitionKey, token));
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user