added some missing cancellation tokens and fixed incorrect tests
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
namespace CoreUnitTests.Infrastructure;
|
||||
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization;
|
||||
using MongoDB.Driver;
|
||||
|
||||
public static class FilterDefinitionExtensions
|
||||
{
|
||||
public static string RenderToJson<TDocument>(this FilterDefinition<TDocument> filter)
|
||||
=> filter.Render(BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(), BsonSerializer.SerializerRegistry).ToJson();
|
||||
|
||||
public static bool EquivalentTo<TDocument>(this FilterDefinition<TDocument> filter, FilterDefinition<TDocument> other)
|
||||
=> filter.RenderToJson() == other.RenderToJson();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using AutoFixture;
|
||||
using AutoFixture.AutoMoq;
|
||||
using Moq;
|
||||
|
||||
namespace CoreUnitTests.Infrastructure;
|
||||
|
||||
public class GenericTestContext<TSut>
|
||||
{
|
||||
public GenericTestContext()
|
||||
{
|
||||
Fixture = new Fixture().Customize(new AutoMoqCustomization());
|
||||
}
|
||||
|
||||
protected Mock<T> MockOf<T>()
|
||||
where T : class
|
||||
{
|
||||
return Fixture.Freeze<Mock<T>>();
|
||||
}
|
||||
|
||||
protected IFixture Fixture { get; set; }
|
||||
|
||||
protected TSut Sut { get => Fixture.Create<TSut>(); }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using MongoDbGenericRepository.Models;
|
||||
|
||||
namespace CoreUnitTests.Infrastructure.Model;
|
||||
|
||||
public class PartitionedTestDocument : TestDocument, IPartitionedDocument
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string PartitionKey { get; set; } = "PartitionedTestDocument";
|
||||
}
|
||||
Reference in New Issue
Block a user