tests for readonly repositories
This commit is contained in:
@@ -11,10 +11,10 @@ using Xunit;
|
||||
|
||||
namespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;
|
||||
|
||||
public class GetMaxValueTests : TestKeyedReadOnlyMongoRepositoryContext<Guid>
|
||||
public class GetMaxValueTests : TestKeyedReadOnlyMongoRepositoryContext<int>
|
||||
{
|
||||
private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == "SomeContent";
|
||||
private readonly Expression<Func<TestDocument, int>> selector = document => document.SomeValue;
|
||||
private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == "SomeContent";
|
||||
private readonly Expression<Func<TestDocumentWithKey<int>, int>> selector = document => document.SomeValue;
|
||||
|
||||
[Fact]
|
||||
public void WithFilterAndSelector_GetsMaxValue()
|
||||
@@ -30,7 +30,7 @@ public class GetMaxValueTests : TestKeyedReadOnlyMongoRepositoryContext<Guid>
|
||||
// Assert
|
||||
result.Should().Be(value);
|
||||
Reader.Verify(
|
||||
x => x.GetMaxValue<TestDocument, Guid, int>(filter, selector, null, CancellationToken.None),
|
||||
x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(filter, selector, null, CancellationToken.None),
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GetMaxValueTests : TestKeyedReadOnlyMongoRepositoryContext<Guid>
|
||||
// Assert
|
||||
result.Should().Be(value);
|
||||
Reader.Verify(
|
||||
x => x.GetMaxValue<TestDocument, Guid, int>(filter, selector, null, token),
|
||||
x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(filter, selector, null, token),
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class GetMaxValueTests : TestKeyedReadOnlyMongoRepositoryContext<Guid>
|
||||
// Assert
|
||||
result.Should().Be(value);
|
||||
Reader.Verify(
|
||||
x => x.GetMaxValue<TestDocument, Guid, int>(filter, selector, partitionKey, CancellationToken.None),
|
||||
x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(filter, selector, partitionKey, CancellationToken.None),
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class GetMaxValueTests : TestKeyedReadOnlyMongoRepositoryContext<Guid>
|
||||
// Assert
|
||||
result.Should().Be(value);
|
||||
Reader.Verify(
|
||||
x => x.GetMaxValue<TestDocument, Guid, int>(filter, selector, partitionKey, token),
|
||||
x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(filter, selector, partitionKey, token),
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ public class GetMaxValueTests : TestKeyedReadOnlyMongoRepositoryContext<Guid>
|
||||
Reader = new Mock<IMongoDbReader>();
|
||||
Reader
|
||||
.Setup(
|
||||
x => x.GetMaxValue<TestDocument, Guid, int>(
|
||||
It.IsAny<Expression<Func<TestDocument, bool>>>(),
|
||||
It.IsAny<Expression<Func<TestDocument, int>>>(),
|
||||
x => x.GetMaxValue<TestDocumentWithKey<int>, int, int>(
|
||||
It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),
|
||||
It.IsAny<Expression<Func<TestDocumentWithKey<int>, int>>>(),
|
||||
It.IsAny<string>(),
|
||||
It.IsAny<CancellationToken>()))
|
||||
.Returns(value);
|
||||
|
||||
Reference in New Issue
Block a user