tests for readonly repositories
This commit is contained in:
@@ -14,10 +14,10 @@ using Xunit;
|
||||
|
||||
namespace CoreUnitTests.KeyedReadOnlyMongoRepositoryTests;
|
||||
|
||||
public class ProjectManyAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<Guid>
|
||||
public class ProjectManyAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<int>
|
||||
{
|
||||
private readonly Expression<Func<TestDocument, bool>> filter = document => document.SomeContent == "SomeContent";
|
||||
private readonly Expression<Func<TestDocument, TestProjection>> projection = document => new TestProjection {NestedData = document.Nested.SomeDate};
|
||||
private readonly Expression<Func<TestDocumentWithKey<int>, bool>> filter = document => document.SomeContent == "SomeContent";
|
||||
private readonly Expression<Func<TestDocumentWithKey<int>, TestProjection>> projection = document => new TestProjection {NestedData = document.Nested.SomeDate};
|
||||
|
||||
[Fact]
|
||||
public async Task WithFilterAndProjection_Projects()
|
||||
@@ -33,7 +33,7 @@ public class ProjectManyAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<Gui
|
||||
// Assert
|
||||
result.Should().OnlyContain(x => projections.Contains(x));
|
||||
Reader.Verify(
|
||||
x => x.ProjectManyAsync<TestDocument, TestProjection, Guid>(
|
||||
x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(
|
||||
filter,
|
||||
projection,
|
||||
null,
|
||||
@@ -56,7 +56,7 @@ public class ProjectManyAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<Gui
|
||||
// Assert
|
||||
result.Should().OnlyContain(x => projections.Contains(x));
|
||||
Reader.Verify(
|
||||
x => x.ProjectManyAsync<TestDocument, TestProjection, Guid>(filter, projection, null, token),
|
||||
x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, null, token),
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ProjectManyAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<Gui
|
||||
// Assert
|
||||
result.Should().OnlyContain(x => projections.Contains(x));
|
||||
Reader.Verify(
|
||||
x => x.ProjectManyAsync<TestDocument, TestProjection, Guid>(filter, projection, partitionKey, CancellationToken.None),
|
||||
x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, partitionKey, CancellationToken.None),
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class ProjectManyAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<Gui
|
||||
// Assert
|
||||
result.Should().OnlyContain(x => projections.Contains(x));
|
||||
Reader.Verify(
|
||||
x => x.ProjectManyAsync<TestDocument, TestProjection, Guid>(filter, projection, partitionKey, token),
|
||||
x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(filter, projection, partitionKey, token),
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
@@ -104,9 +104,9 @@ public class ProjectManyAsyncTests : TestKeyedReadOnlyMongoRepositoryContext<Gui
|
||||
Reader = new Mock<IMongoDbReader>();
|
||||
Reader
|
||||
.Setup(
|
||||
x => x.ProjectManyAsync<TestDocument, TestProjection, Guid>(
|
||||
It.IsAny<Expression<Func<TestDocument, bool>>>(),
|
||||
It.IsAny<Expression<Func<TestDocument, TestProjection>>>(),
|
||||
x => x.ProjectManyAsync<TestDocumentWithKey<int>, TestProjection, int>(
|
||||
It.IsAny<Expression<Func<TestDocumentWithKey<int>, bool>>>(),
|
||||
It.IsAny<Expression<Func<TestDocumentWithKey<int>, TestProjection>>>(),
|
||||
It.IsAny<string>(),
|
||||
It.IsAny<CancellationToken>()))
|
||||
.ReturnsAsync(projections);
|
||||
|
||||
Reference in New Issue
Block a user