Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 00bd61e220 | |||
| c5240aea9a | |||
| a748189f84 | |||
| 6ce49c378d | |||
| c45b0a49d7 | |||
| e5f65e8f19 | |||
| 720e09bdbc | |||
| 2b0b04ec7b | |||
| e8842f8991 | |||
| a54b702841 | |||
| 9c48653dc6 | |||
| b083988509 | |||
| 7bd356c7da | |||
| f59cccb3d9 | |||
| 710b7b992f |
@@ -0,0 +1,35 @@
|
|||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
|
||||||
|
env:
|
||||||
|
PACKAGE_VERSION: ${GITHUB_REF/refs\/tags\/v/}
|
||||||
|
PACKAGE_OWNER: ${{ github.repository_owner }}
|
||||||
|
PACKAGE_NAME: MongoDbGenericRepository.${{ env.PACKAGE_VERSION }}.nupkg
|
||||||
|
PACKAGE_SOURCE: https://git.home.cuco.li/api/packages/${{ env.PACKAGE_OWNER }}/nuget/index.json
|
||||||
|
PACKAGE_TOKEN: ${{ secrets.PACKAGE_PUSH_TOKEN }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: '8.x.x'
|
||||||
|
- name: Verify commit exists in origin/master
|
||||||
|
run: |
|
||||||
|
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
|
||||||
|
git branch --remote --contains | grep origin/master
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build --configuration Release /p:Version=${{ env.PACKAGE_VERSION }}
|
||||||
|
- name: Test
|
||||||
|
run: dotnet test --configuration Release /p:Version=${{ env.PACKAGE_VERSION }} --no-build
|
||||||
|
- name: Pack
|
||||||
|
run: dotnet pack --configuration Release /p:Version=${{ env.PACKAGE_VERSION }} --no-build --output .
|
||||||
|
- name: Push
|
||||||
|
run: dotnet nuget push ${{ env.PACKAGE_NAME }} --source ${{ env.PACKAGE_SOURCE }} --api-key ${GITHUB_TOKEN}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ env.PACKAGE_TOKEN }}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
For more information on how to configure your ASP.NET application, please visit
|
|
||||||
http://go.microsoft.com/fwlink/?LinkId=169433
|
|
||||||
-->
|
|
||||||
<configuration>
|
|
||||||
<connectionStrings>
|
|
||||||
<add name="MongoDbTests" connectionString="mongodb://localhost:27017" />
|
|
||||||
</connectionStrings>
|
|
||||||
</configuration>
|
|
||||||
@@ -1,33 +1,28 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<LangVersion>10</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.1.2" />
|
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.11" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.2" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
|
||||||
<PackageReference Include="MongoDB.Driver" Version="2.15.0" />
|
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
|
||||||
<PackageReference Include="xunit" Version="2.5.0" />
|
<PackageReference Include="xunit" Version="2.9.2" />
|
||||||
<PackageReference Include="xunit.runner.console" Version="2.5.0">
|
<PackageReference Include="xunit.runner.console" Version="2.9.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="App.config">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MongoDbGenericRepository\MongoDbGenericRepository.csproj" />
|
<ProjectReference Include="..\MongoDbGenericRepository\MongoDbGenericRepository.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -11,10 +11,8 @@ using Xunit;
|
|||||||
|
|
||||||
namespace CoreIntegrationTests.Infrastructure
|
namespace CoreIntegrationTests.Infrastructure
|
||||||
{
|
{
|
||||||
public abstract partial class MongoDbDocumentTestBase<T>
|
public abstract partial class MongoDbDocumentTestBase<T> where T : TestDoc, new()
|
||||||
where T : TestDoc, new()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly MongoDbTestFixture<T, Guid> _fixture;
|
private readonly MongoDbTestFixture<T, Guid> _fixture;
|
||||||
|
|
||||||
protected MongoDbDocumentTestBase(MongoDbTestFixture<T, Guid> fixture)
|
protected MongoDbDocumentTestBase(MongoDbTestFixture<T, Guid> fixture)
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ using Xunit;
|
|||||||
namespace CoreIntegrationTests.Infrastructure
|
namespace CoreIntegrationTests.Infrastructure
|
||||||
{
|
{
|
||||||
public abstract partial class MongoDbDocumentTestBase<T> :
|
public abstract partial class MongoDbDocumentTestBase<T> :
|
||||||
IClassFixture<MongoDbTestFixture<T, Guid>>
|
IClassFixture<MongoDbTestFixture<T, Guid>> where T : TestDoc, new()
|
||||||
where T : TestDoc, new()
|
|
||||||
{
|
{
|
||||||
#region Update One
|
#region Update One
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace CoreIntegrationTests.Infrastructure
|
|||||||
|
|
||||||
public class TestDoc : Document
|
public class TestDoc : Document
|
||||||
{
|
{
|
||||||
public TestDoc()
|
protected TestDoc()
|
||||||
{
|
{
|
||||||
Version = 2;
|
Version = 2;
|
||||||
Nested = new Nested
|
Nested = new Nested
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace CoreIntegrationTests.Infrastructure
|
|||||||
|
|
||||||
public class TestTKeyRepository<TKey> : BaseMongoRepository<TKey>, ITestRepository<TKey> where TKey : IEquatable<TKey>
|
public class TestTKeyRepository<TKey> : BaseMongoRepository<TKey>, ITestRepository<TKey> where TKey : IEquatable<TKey>
|
||||||
{
|
{
|
||||||
const string connectionString = "mongodb://localhost:27017/MongoDbTests";
|
const string connectionString = "mongodb://test:Test123!@10.0.3.4:27017/MongoDbTests";
|
||||||
private static readonly ITestRepository<TKey> _instance = new TestTKeyRepository<TKey>(connectionString);
|
private static readonly ITestRepository<TKey> _instance = new TestTKeyRepository<TKey>(connectionString);
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
private TestTKeyRepository(string connectionString) : base(connectionString)
|
private TestTKeyRepository(string connectionString) : base(connectionString)
|
||||||
@@ -44,7 +44,7 @@ namespace CoreIntegrationTests.Infrastructure
|
|||||||
public sealed class TestRepository : BaseMongoRepository, ITestRepository
|
public sealed class TestRepository : BaseMongoRepository, ITestRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
const string connectionString = "mongodb://localhost:27017";
|
const string connectionString = "mongodb://test:Test123!@10.0.3.4:27017";
|
||||||
private static readonly ITestRepository _instance = new TestRepository(connectionString, "MongoDbTests");
|
private static readonly ITestRepository _instance = new TestRepository(connectionString, "MongoDbTests");
|
||||||
|
|
||||||
// Explicit static constructor to tell C# compiler
|
// Explicit static constructor to tell C# compiler
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>warnings</Nullable>
|
<Nullable>warnings</Nullable>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||||
<AnalysisLevel>latest</AnalysisLevel>
|
<AnalysisLevel>latest</AnalysisLevel>
|
||||||
|
<LangVersion>10</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoFixture" Version="4.18.0" />
|
<PackageReference Include="AutoFixture" Version="4.18.1" />
|
||||||
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.0" />
|
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.1" />
|
||||||
<PackageReference Include="FluentAssertions" Version="6.11.0" />
|
<PackageReference Include="FluentAssertions" Version="6.12.2" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||||
<PackageReference Include="Moq" Version="4.18.4" />
|
<PackageReference Include="Moq" Version="4.20.72" />
|
||||||
<PackageReference Include="xunit" Version="2.5.0" />
|
<PackageReference Include="xunit" Version="2.9.2" />
|
||||||
<PackageReference Include="xunit.runner.console" Version="2.5.0">
|
<PackageReference Include="xunit.runner.console" Version="2.9.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
<PackageReference Include="coverlet.collector" Version="6.0.2">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -531,8 +531,8 @@ public class UpdateManyAsyncTests : GenericTestContext<MongoDbUpdater>
|
|||||||
private Mock<IMongoCollection<TestDocument>> SetupCollection(long count, string partitionKey = null)
|
private Mock<IMongoCollection<TestDocument>> SetupCollection(long count, string partitionKey = null)
|
||||||
{
|
{
|
||||||
var replacedId = Fixture.Create<Guid>();
|
var replacedId = Fixture.Create<Guid>();
|
||||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, count, BsonValue.Create(replacedId));
|
var replaceResult = new ReplaceOneResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||||
var updateResult = new UpdateResult.Acknowledged(count, count, BsonValue.Create(replacedId));
|
var updateResult = new UpdateResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||||
|
|
||||||
var collection = MockOf<IMongoCollection<TestDocument>>();
|
var collection = MockOf<IMongoCollection<TestDocument>>();
|
||||||
collection
|
collection
|
||||||
|
|||||||
@@ -530,8 +530,8 @@ public class UpdateManyTests : GenericTestContext<MongoDbUpdater>
|
|||||||
private Mock<IMongoCollection<TestDocument>> SetupCollection(long count, string partitionKey = null)
|
private Mock<IMongoCollection<TestDocument>> SetupCollection(long count, string partitionKey = null)
|
||||||
{
|
{
|
||||||
var replacedId = Fixture.Create<Guid>();
|
var replacedId = Fixture.Create<Guid>();
|
||||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, count, BsonValue.Create(replacedId));
|
var replaceResult = new ReplaceOneResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||||
var updateResult = new UpdateResult.Acknowledged(count, count, BsonValue.Create(replacedId));
|
var updateResult = new UpdateResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||||
|
|
||||||
var collection = MockOf<IMongoCollection<TestDocument>>();
|
var collection = MockOf<IMongoCollection<TestDocument>>();
|
||||||
collection
|
collection
|
||||||
|
|||||||
@@ -755,8 +755,8 @@ public class UpdateOneAsyncTests : GenericTestContext<MongoDbUpdater>
|
|||||||
{
|
{
|
||||||
var replacedId = Fixture.Create<Guid>();
|
var replacedId = Fixture.Create<Guid>();
|
||||||
var count = Fixture.Create<long>();
|
var count = Fixture.Create<long>();
|
||||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, 1, BsonValue.Create(replacedId));
|
var replaceResult = new ReplaceOneResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||||
var updateResult = new UpdateResult.Acknowledged(count, 1, BsonValue.Create(replacedId));
|
var updateResult = new UpdateResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||||
|
|
||||||
var collection = MockOf<IMongoCollection<TestDocument>>();
|
var collection = MockOf<IMongoCollection<TestDocument>>();
|
||||||
collection
|
collection
|
||||||
|
|||||||
@@ -754,8 +754,8 @@ public class UpdateOneTests : GenericTestContext<MongoDbUpdater>
|
|||||||
{
|
{
|
||||||
var replacedId = Fixture.Create<Guid>();
|
var replacedId = Fixture.Create<Guid>();
|
||||||
var count = Fixture.Create<long>();
|
var count = Fixture.Create<long>();
|
||||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, 1, BsonValue.Create(replacedId));
|
var replaceResult = new ReplaceOneResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||||
var updateResult = new UpdateResult.Acknowledged(count, 1, BsonValue.Create(replacedId));
|
var updateResult = new UpdateResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||||
|
|
||||||
var collection = MockOf<IMongoCollection<TestDocument>>();
|
var collection = MockOf<IMongoCollection<TestDocument>>();
|
||||||
collection
|
collection
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using MongoDB.Driver;
|
|||||||
public static class FilterDefinitionExtensions
|
public static class FilterDefinitionExtensions
|
||||||
{
|
{
|
||||||
public static string RenderToJson<TDocument>(this FilterDefinition<TDocument> filter)
|
public static string RenderToJson<TDocument>(this FilterDefinition<TDocument> filter)
|
||||||
=> filter.Render(BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(), BsonSerializer.SerializerRegistry).ToJson();
|
=> filter.Render(new RenderArgs<TDocument>(BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(), BsonSerializer.SerializerRegistry)).ToJson();
|
||||||
|
|
||||||
public static bool EquivalentTo<TDocument>(this FilterDefinition<TDocument> filter, FilterDefinition<TDocument> other)
|
public static bool EquivalentTo<TDocument>(this FilterDefinition<TDocument> filter, FilterDefinition<TDocument> other)
|
||||||
=> filter.RenderToJson() == other.RenderToJson();
|
=> filter.RenderToJson() == other.RenderToJson();
|
||||||
|
|||||||
@@ -59,9 +59,7 @@ public static class IndexExtensions
|
|||||||
|
|
||||||
private static string RenderIndexModelKeys<TDocument>(IndexKeysDefinition<TDocument> keys)
|
private static string RenderIndexModelKeys<TDocument>(IndexKeysDefinition<TDocument> keys)
|
||||||
{
|
{
|
||||||
var indexModelRendered = keys.Render(
|
var indexModelRendered = keys.Render(new RenderArgs<TDocument>(BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(), BsonSerializer.SerializerRegistry));
|
||||||
BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(),
|
|
||||||
BsonSerializer.SerializerRegistry);
|
|
||||||
|
|
||||||
var result = indexModelRendered.ToString();
|
var result = indexModelRendered.ToString();
|
||||||
return result.Replace(" ", "");
|
return result.Replace(" ", "");
|
||||||
|
|||||||
@@ -8,13 +8,9 @@ public static class UpdateDefinitionExtensions
|
|||||||
{
|
{
|
||||||
public static bool EquivalentTo<TDocument>(this UpdateDefinition<TDocument> update, UpdateDefinition<TDocument> expected)
|
public static bool EquivalentTo<TDocument>(this UpdateDefinition<TDocument> update, UpdateDefinition<TDocument> expected)
|
||||||
{
|
{
|
||||||
var renderedUpdate = update.Render(
|
var renderedUpdate = update.Render(new RenderArgs<TDocument>(BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(), BsonSerializer.SerializerRegistry));
|
||||||
BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(),
|
|
||||||
BsonSerializer.SerializerRegistry);
|
|
||||||
|
|
||||||
var renderedExpected = expected.Render(
|
var renderedExpected = expected.Render(new RenderArgs<TDocument>(BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(), BsonSerializer.SerializerRegistry) );
|
||||||
BsonSerializer.SerializerRegistry.GetSerializer<TDocument>(),
|
|
||||||
BsonSerializer.SerializerRegistry);
|
|
||||||
|
|
||||||
return renderedUpdate.Equals(renderedExpected);
|
return renderedUpdate.Equals(renderedExpected);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,55 @@
|
|||||||
http://go.microsoft.com/fwlink/?LinkId=169433
|
http://go.microsoft.com/fwlink/?LinkId=169433
|
||||||
-->
|
-->
|
||||||
<configuration>
|
<configuration>
|
||||||
<connectionStrings>
|
|
||||||
<add name="MongoDbTests" connectionString="mongodb://localhost:27017" />
|
|
||||||
</connectionStrings>
|
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3" />
|
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Win32.Registry" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="MongoDB.Bson" publicKeyToken="null" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.20.0.0" newVersion="2.20.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="MongoDB.Driver.Core" publicKeyToken="null" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.20.0.0" newVersion="2.20.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="MongoDB.Libmongocrypt" publicKeyToken="null" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="mscorlib" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Security.AccessControl" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-0.7.3.0" newVersion="0.7.3.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using IntegrationTests.Infrastructure;
|
using MongoDB.Bson.Serialization.Attributes;
|
||||||
using MongoDB.Bson.Serialization.Attributes;
|
|
||||||
using MongoDbGenericRepository.Attributes;
|
using MongoDbGenericRepository.Attributes;
|
||||||
using MongoDbGenericRepository.Models;
|
using MongoDbGenericRepository.Models;
|
||||||
using System;
|
using System;
|
||||||
|
using IntegrationTests.Infrastructure;
|
||||||
|
using TestDoc = IntegrationTests.Infrastructure.TestDoc;
|
||||||
|
|
||||||
namespace IntegrationTests
|
namespace IntegrationTests
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using IntegrationTests.Infrastructure;
|
using IntegrationTests.Infrastructure;
|
||||||
using MongoDbGenericRepository.Models;
|
using MongoDbGenericRepository.Models;
|
||||||
|
using TestDoc = IntegrationTests.Infrastructure.TestDoc;
|
||||||
|
|
||||||
namespace IntegrationTests
|
namespace IntegrationTests
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using IntegrationTests.Infrastructure;
|
using IntegrationTests.Infrastructure;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NUnit.Framework.Internal;
|
||||||
|
using TestDoc = IntegrationTests.Infrastructure.TestDoc;
|
||||||
|
|
||||||
namespace IntegrationTests
|
namespace IntegrationTests
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -41,8 +41,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
[OneTimeSetUp]
|
[OneTimeSetUp]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
var connectionString = ConfigurationManager.ConnectionStrings["MongoDbTests"].ConnectionString;
|
SUT = new TestRepository("mongodb://test:Test123!@10.0.3.4:27017", "MongoDbTests");
|
||||||
SUT = new TestRepository(connectionString, "MongoDbTests");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[OneTimeTearDown]
|
[OneTimeTearDown]
|
||||||
|
|||||||
+90
-90
@@ -7,6 +7,7 @@ using System.Diagnostics;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using NUnit.Framework.Legacy;
|
||||||
|
|
||||||
namespace IntegrationTests.Infrastructure
|
namespace IntegrationTests.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -65,8 +66,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
[OneTimeSetUp]
|
[OneTimeSetUp]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
var connectionString = ConfigurationManager.ConnectionStrings["MongoDbTests"].ConnectionString;
|
SUT = new TestRepository("mongodb://test:Test123!@10.0.3.4:27017/", "MongoDbTests");
|
||||||
SUT = new TestRepository(connectionString, "MongoDbTests");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[OneTimeTearDown]
|
[OneTimeTearDown]
|
||||||
@@ -95,7 +95,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Assert
|
// Assert
|
||||||
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id))
|
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id))
|
||||||
: SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey);
|
: SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey);
|
||||||
Assert.AreEqual(1, count, GetTestName());
|
Assert.That(count, Is.EqualTo(1), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -108,7 +108,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Assert
|
// Assert
|
||||||
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id))
|
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id))
|
||||||
: SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey);
|
: SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey);
|
||||||
Assert.AreEqual(1, count, GetTestName());
|
Assert.That(count, Is.EqualTo(1), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -123,7 +123,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
|| e.Id.Equals(documents[1].Id))
|
|| e.Id.Equals(documents[1].Id))
|
||||||
: SUT.Count<T>(e => e.Id.Equals(documents[0].Id)
|
: SUT.Count<T>(e => e.Id.Equals(documents[0].Id)
|
||||||
|| e.Id.Equals(documents[1].Id), PartitionKey);
|
|| e.Id.Equals(documents[1].Id), PartitionKey);
|
||||||
Assert.AreEqual(2, count, GetTestName());
|
Assert.That(count, Is.EqualTo(2), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -138,7 +138,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
|| e.Id.Equals(documents[1].Id))
|
|| e.Id.Equals(documents[1].Id))
|
||||||
: SUT.Count<T>(e => e.Id.Equals(documents[0].Id)
|
: SUT.Count<T>(e => e.Id.Equals(documents[0].Id)
|
||||||
|| e.Id.Equals(documents[1].Id), PartitionKey);
|
|| e.Id.Equals(documents[1].Id), PartitionKey);
|
||||||
Assert.AreEqual(2, count, GetTestName());
|
Assert.That(count, Is.EqualTo(2), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.GetByIdAsync<T>(document.Id, PartitionKey);
|
var result = await SUT.GetByIdAsync<T>(document.Id, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -167,7 +167,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.GetById<T>(document.Id, PartitionKey);
|
var result = SUT.GetById<T>(document.Id, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -179,7 +179,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.GetOneAsync<T>(x => x.Id.Equals(document.Id), PartitionKey);
|
var result = await SUT.GetOneAsync<T>(x => x.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -191,7 +191,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.GetOne<T>(x => x.Id.Equals(document.Id), PartitionKey);
|
var result = SUT.GetOne<T>(x => x.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -204,7 +204,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
var cursor = SUT.GetCursor<T>(x => x.Id.Equals(document.Id), PartitionKey);
|
var cursor = SUT.GetCursor<T>(x => x.Id.Equals(document.Id), PartitionKey);
|
||||||
var count = cursor.CountDocuments();
|
var count = cursor.CountDocuments();
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, count, GetTestName());
|
Assert.That(count, Is.EqualTo(1), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -216,7 +216,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.AnyAsync<T>(x => x.Id.Equals(document.Id), PartitionKey);
|
var result = await SUT.AnyAsync<T>(x => x.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(true, result, GetTestName());
|
Assert.That(result, Is.EqualTo(true), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -228,7 +228,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.AnyAsync<T>(x => x.Id.Equals(Guid.NewGuid()), PartitionKey);
|
var result = await SUT.AnyAsync<T>(x => x.Id.Equals(Guid.NewGuid()), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(false, result, GetTestName());
|
Assert.That(result, Is.EqualTo(false), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -240,7 +240,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.Any<T>(x => x.Id.Equals(document.Id), PartitionKey);
|
var result = SUT.Any<T>(x => x.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(true, result, GetTestName());
|
Assert.That(result, Is.EqualTo(true), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -252,7 +252,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.Any<T>(x => x.Id.Equals(Guid.NewGuid()), PartitionKey);
|
var result = SUT.Any<T>(x => x.Id.Equals(Guid.NewGuid()), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(false, result, GetTestName());
|
Assert.That(result, Is.EqualTo(false), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -266,7 +266,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.GetAllAsync<T>(x => x.SomeContent == content, PartitionKey);
|
var result = await SUT.GetAllAsync<T>(x => x.SomeContent == content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result.Count, GetTestName());
|
Assert.That(result.Count, Is.EqualTo(5), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -280,7 +280,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.GetAll<T>(x => x.SomeContent == content, PartitionKey);
|
var result = SUT.GetAll<T>(x => x.SomeContent == content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result.Count, GetTestName());
|
Assert.That(result.Count, Is.EqualTo(5), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -294,7 +294,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.CountAsync<T>(x => x.SomeContent == content, PartitionKey);
|
var result = await SUT.CountAsync<T>(x => x.SomeContent == content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result, GetTestName());
|
Assert.That(result, Is.EqualTo(5), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -308,7 +308,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.Count<T>(x => x.SomeContent == content, PartitionKey);
|
var result = SUT.Count<T>(x => x.SomeContent == content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result, GetTestName());
|
Assert.That(result, Is.EqualTo(5), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Read
|
#endregion Read
|
||||||
@@ -326,10 +326,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.UpdateOne<T>(document);
|
var result = SUT.UpdateOne<T>(document);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result);
|
ClassicAssert.IsTrue(result);
|
||||||
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -343,10 +343,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.UpdateOneAsync<T>(document);
|
var result = await SUT.UpdateOneAsync<T>(document);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result);
|
ClassicAssert.IsTrue(result);
|
||||||
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -359,10 +359,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.UpdateOne<T, string>(document, x => x.SomeContent, content);
|
var result = SUT.UpdateOne<T, string>(document, x => x.SomeContent, content);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result, GetTestName());
|
ClassicAssert.IsTrue(result, GetTestName());
|
||||||
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -375,10 +375,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.UpdateOneAsync<T, string>(document, x => x.SomeContent, content);
|
var result = await SUT.UpdateOneAsync<T, string>(document, x => x.SomeContent, content);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result, GetTestName());
|
ClassicAssert.IsTrue(result, GetTestName());
|
||||||
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -391,10 +391,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.UpdateOne<T, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);
|
var result = SUT.UpdateOne<T, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result, GetTestName());
|
ClassicAssert.IsTrue(result, GetTestName());
|
||||||
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -407,10 +407,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.UpdateOneAsync<T, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);
|
var result = await SUT.UpdateOneAsync<T, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result, GetTestName());
|
ClassicAssert.IsTrue(result, GetTestName());
|
||||||
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -430,13 +430,13 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.UpdateOneAsync<T>(document, updateDef);
|
var result = await SUT.UpdateOneAsync<T>(document, updateDef);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result);
|
ClassicAssert.IsTrue(result);
|
||||||
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument);
|
ClassicAssert.IsNotNull(updatedDocument);
|
||||||
Assert.AreEqual(childrenToAdd[0].Type, updatedDocument.Children[0].Type, GetTestName());
|
Assert.That(updatedDocument.Children[0].Type, Is.EqualTo(childrenToAdd[0].Type), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[0].Value, updatedDocument.Children[0].Value, GetTestName());
|
Assert.That(updatedDocument.Children[0].Value, Is.EqualTo(childrenToAdd[0].Value), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[1].Type, updatedDocument.Children[1].Type, GetTestName());
|
Assert.That(updatedDocument.Children[1].Type, Is.EqualTo(childrenToAdd[1].Type), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[1].Value, updatedDocument.Children[1].Value, GetTestName());
|
Assert.That(updatedDocument.Children[1].Value, Is.EqualTo(childrenToAdd[1].Value), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -456,13 +456,13 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.UpdateOne<T>(document, updateDef);
|
var result = SUT.UpdateOne<T>(document, updateDef);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result);
|
ClassicAssert.IsTrue(result);
|
||||||
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument);
|
ClassicAssert.IsNotNull(updatedDocument);
|
||||||
Assert.AreEqual(childrenToAdd[0].Type, updatedDocument.Children[0].Type, GetTestName());
|
Assert.That(updatedDocument.Children[0].Type, Is.EqualTo(childrenToAdd[0].Type), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[0].Value, updatedDocument.Children[0].Value, GetTestName());
|
Assert.That(updatedDocument.Children[0].Value, Is.EqualTo(childrenToAdd[0].Value), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[1].Type, updatedDocument.Children[1].Type, GetTestName());
|
Assert.That(updatedDocument.Children[1].Type, Is.EqualTo(childrenToAdd[1].Type), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[1].Value, updatedDocument.Children[1].Value, GetTestName());
|
Assert.That(updatedDocument.Children[1].Value, Is.EqualTo(childrenToAdd[1].Value), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Update
|
#endregion Update
|
||||||
@@ -478,8 +478,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.DeleteOne<T>(document);
|
var result = SUT.DeleteOne<T>(document);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, result);
|
Assert.That(result, Is.EqualTo(1));
|
||||||
Assert.IsFalse(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -491,8 +491,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.DeleteOne<T>(e => e.Id.Equals(document.Id), PartitionKey);
|
var result = SUT.DeleteOne<T>(e => e.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, result);
|
Assert.That(result, Is.EqualTo(1));
|
||||||
Assert.IsFalse(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -504,8 +504,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.DeleteOneAsync<T>(document);
|
var result = await SUT.DeleteOneAsync<T>(document);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, result);
|
Assert.That(result, Is.EqualTo(1));
|
||||||
Assert.IsFalse(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -517,8 +517,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.DeleteOneAsync<T>(e => e.Id.Equals(document.Id), PartitionKey);
|
var result = await SUT.DeleteOneAsync<T>(e => e.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, result);
|
Assert.That(result, Is.EqualTo(1));
|
||||||
Assert.IsFalse(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -532,8 +532,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.DeleteManyAsync<T>(e => e.SomeContent == criteria, PartitionKey);
|
var result = await SUT.DeleteManyAsync<T>(e => e.SomeContent == criteria, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result);
|
Assert.That(result, Is.EqualTo(5));
|
||||||
Assert.IsFalse(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -547,8 +547,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.DeleteManyAsync<T>(documents);
|
var result = await SUT.DeleteManyAsync<T>(documents);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result);
|
Assert.That(result, Is.EqualTo(5));
|
||||||
Assert.IsFalse(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -562,8 +562,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.DeleteMany<T>(e => e.SomeContent == criteria, PartitionKey);
|
var result = SUT.DeleteMany<T>(e => e.SomeContent == criteria, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result);
|
Assert.That(result, Is.EqualTo(5));
|
||||||
Assert.IsFalse(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -577,8 +577,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.DeleteMany<T>(documents);
|
var result = SUT.DeleteMany<T>(documents);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result);
|
Assert.That(result, Is.EqualTo(5));
|
||||||
Assert.IsFalse(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Delete
|
#endregion Delete
|
||||||
@@ -605,10 +605,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
},
|
},
|
||||||
PartitionKey);
|
PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
Assert.AreEqual(someContent, result.SomeContent, GetTestName());
|
Assert.That(result.SomeContent, Is.EqualTo(someContent), GetTestName());
|
||||||
Assert.AreEqual(someDate.Minute, result.SomeDate.Minute, GetTestName());
|
Assert.That(result.SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());
|
||||||
Assert.AreEqual(someDate.Second, result.SomeDate.Second, GetTestName());
|
Assert.That(result.SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -631,10 +631,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
},
|
},
|
||||||
PartitionKey);
|
PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
Assert.AreEqual(someContent, result.SomeContent, GetTestName());
|
Assert.That(result.SomeContent, Is.EqualTo(someContent), GetTestName());
|
||||||
Assert.AreEqual(someDate.Minute, result.SomeDate.Minute, GetTestName());
|
Assert.That(result.SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());
|
||||||
Assert.AreEqual(someDate.Second, result.SomeDate.Second, GetTestName());
|
Assert.That(result.SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -661,10 +661,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
},
|
},
|
||||||
PartitionKey);
|
PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result.Count, GetTestName());
|
Assert.That(result.Count, Is.EqualTo(5), GetTestName());
|
||||||
Assert.AreEqual(someContent, result.First().SomeContent, GetTestName());
|
Assert.That(result.First().SomeContent, Is.EqualTo(someContent), GetTestName());
|
||||||
Assert.AreEqual(someDate.Minute, result.First().SomeDate.Minute, GetTestName());
|
Assert.That(result.First().SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());
|
||||||
Assert.AreEqual(someDate.Second, result.First().SomeDate.Second, GetTestName());
|
Assert.That(result.First().SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -691,10 +691,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
},
|
},
|
||||||
PartitionKey);
|
PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result.Count, GetTestName());
|
Assert.That(result.Count, Is.EqualTo(5), GetTestName());
|
||||||
Assert.AreEqual(someContent, result.First().SomeContent, GetTestName());
|
Assert.That(result.First().SomeContent, Is.EqualTo(someContent), GetTestName());
|
||||||
Assert.AreEqual(someDate.Minute, result.First().SomeDate.Minute, GetTestName());
|
Assert.That(result.First().SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());
|
||||||
Assert.AreEqual(someDate.Second, result.First().SomeDate.Second, GetTestName());
|
Assert.That(result.First().SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Project
|
#endregion Project
|
||||||
@@ -730,11 +730,11 @@ namespace IntegrationTests.Infrastructure
|
|||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var key1Group = result.First(e => e.Key == 1);
|
var key1Group = result.First(e => e.Key == 1);
|
||||||
Assert.NotNull(key1Group);
|
ClassicAssert.NotNull(key1Group);
|
||||||
Assert.AreEqual(3, key1Group.Content.Count);
|
Assert.That(key1Group.Content.Count, Is.EqualTo(3));
|
||||||
var key2Group = result.First(e => e.Key == 2);
|
var key2Group = result.First(e => e.Key == 2);
|
||||||
Assert.NotNull(key2Group);
|
ClassicAssert.NotNull(key2Group);
|
||||||
Assert.AreEqual(2, key2Group.Content.Count);
|
Assert.That(key2Group.Content.Count, Is.EqualTo(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -775,11 +775,11 @@ namespace IntegrationTests.Infrastructure
|
|||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var key1Group = result.First(e => e.Key == 4);
|
var key1Group = result.First(e => e.Key == 4);
|
||||||
Assert.NotNull(key1Group);
|
ClassicAssert.NotNull(key1Group);
|
||||||
Assert.AreEqual(3, key1Group.Content.Count);
|
Assert.That(key1Group.Content.Count, Is.EqualTo(3));
|
||||||
var key2Group = result.First(e => e.Key == 5);
|
var key2Group = result.First(e => e.Key == 5);
|
||||||
Assert.NotNull(key2Group);
|
ClassicAssert.NotNull(key2Group);
|
||||||
Assert.AreEqual(1, key2Group.Content.Count);
|
Assert.That(key2Group.Content.Count, Is.EqualTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Group By
|
#endregion Group By
|
||||||
@@ -818,4 +818,4 @@ namespace IntegrationTests.Infrastructure
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ using System.Diagnostics;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using NUnit.Framework.Legacy;
|
||||||
|
|
||||||
namespace IntegrationTests.Infrastructure
|
namespace IntegrationTests.Infrastructure
|
||||||
{
|
{
|
||||||
@@ -66,8 +67,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
[OneTimeSetUp]
|
[OneTimeSetUp]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
var connectionString = ConfigurationManager.ConnectionStrings["MongoDbTests"].ConnectionString;
|
SUT = new TestRepository("mongodb://test:Test123!@10.0.3.4:27017", "MongoDbTests");
|
||||||
SUT = new TestRepository(connectionString, "MongoDbTests");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[OneTimeTearDown]
|
[OneTimeTearDown]
|
||||||
@@ -96,7 +96,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Assert
|
// Assert
|
||||||
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T, TKey>(e => e.Id.Equals(document.Id))
|
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T, TKey>(e => e.Id.Equals(document.Id))
|
||||||
: SUT.Count<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);
|
: SUT.Count<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);
|
||||||
Assert.AreEqual(1, count, GetTestName());
|
Assert.That(count, Is.EqualTo(1), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -109,7 +109,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Assert
|
// Assert
|
||||||
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T, TKey>(e => e.Id.Equals(document.Id))
|
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T, TKey>(e => e.Id.Equals(document.Id))
|
||||||
: SUT.Count<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);
|
: SUT.Count<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);
|
||||||
Assert.AreEqual(1, count, GetTestName());
|
Assert.That(count, Is.EqualTo(1), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -124,7 +124,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
|| e.Id.Equals(documents[1].Id))
|
|| e.Id.Equals(documents[1].Id))
|
||||||
: SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id)
|
: SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id)
|
||||||
|| e.Id.Equals(documents[1].Id), PartitionKey);
|
|| e.Id.Equals(documents[1].Id), PartitionKey);
|
||||||
Assert.AreEqual(2, count, GetTestName());
|
Assert.That(count, Is.EqualTo(2), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -139,7 +139,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
|| e.Id.Equals(documents[1].Id))
|
|| e.Id.Equals(documents[1].Id))
|
||||||
: SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id)
|
: SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id)
|
||||||
|| e.Id.Equals(documents[1].Id), PartitionKey);
|
|| e.Id.Equals(documents[1].Id), PartitionKey);
|
||||||
Assert.AreEqual(2, count, GetTestName());
|
Assert.That(count, Is.EqualTo(2), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.GetByIdAsync<T, TKey>(document.Id, PartitionKey);
|
var result = await SUT.GetByIdAsync<T, TKey>(document.Id, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -168,7 +168,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
var result = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -180,7 +180,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.GetOneAsync<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);
|
var result = await SUT.GetOneAsync<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -192,7 +192,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.GetOne<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);
|
var result = SUT.GetOne<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -205,7 +205,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
var cursor = SUT.GetCursor<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);
|
var cursor = SUT.GetCursor<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);
|
||||||
var count = cursor.CountDocuments();
|
var count = cursor.CountDocuments();
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, count, GetTestName());
|
Assert.That(count, Is.EqualTo(1), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -217,7 +217,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.AnyAsync<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);
|
var result = await SUT.AnyAsync<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(true, result, GetTestName());
|
Assert.That(result, Is.EqualTo(true), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -229,7 +229,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.AnyAsync<T, TKey>(x => x.Id.Equals(document.Init<TKey>()), PartitionKey);
|
var result = await SUT.AnyAsync<T, TKey>(x => x.Id.Equals(document.Init<TKey>()), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(false, result, GetTestName());
|
Assert.That(result, Is.EqualTo(false), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -241,7 +241,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.Any<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);
|
var result = SUT.Any<T, TKey>(x => x.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(true, result, GetTestName());
|
Assert.That(result, Is.EqualTo(true), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -253,7 +253,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.Any<T, TKey>(x => x.Id.Equals(document.Init<TKey>()), PartitionKey);
|
var result = SUT.Any<T, TKey>(x => x.Id.Equals(document.Init<TKey>()), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(false, result, GetTestName());
|
Assert.That(result, Is.EqualTo(false), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -267,7 +267,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.GetAllAsync<T, TKey>(x => x.SomeContent == content, PartitionKey);
|
var result = await SUT.GetAllAsync<T, TKey>(x => x.SomeContent == content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result.Count, GetTestName());
|
Assert.That(result.Count, Is.EqualTo(5), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -281,7 +281,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.GetAll<T, TKey>(x => x.SomeContent == content, PartitionKey);
|
var result = SUT.GetAll<T, TKey>(x => x.SomeContent == content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result.Count, GetTestName());
|
Assert.That(result.Count, Is.EqualTo(5), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -295,7 +295,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.CountAsync<T, TKey>(x => x.SomeContent == content, PartitionKey);
|
var result = await SUT.CountAsync<T, TKey>(x => x.SomeContent == content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result, GetTestName());
|
Assert.That(result, Is.EqualTo(5), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -309,7 +309,7 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.Count<T, TKey>(x => x.SomeContent == content, PartitionKey);
|
var result = SUT.Count<T, TKey>(x => x.SomeContent == content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result, GetTestName());
|
Assert.That(result, Is.EqualTo(5), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Read
|
#endregion Read
|
||||||
@@ -327,10 +327,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.UpdateOne<T, TKey>(document);
|
var result = SUT.UpdateOne<T, TKey>(document);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result);
|
Assert.That(result, Is.True);
|
||||||
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -344,10 +344,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.UpdateOneAsync<T, TKey>(document);
|
var result = await SUT.UpdateOneAsync<T, TKey>(document);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result);
|
Assert.That(result, Is.True);
|
||||||
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -360,10 +360,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.UpdateOne<T, TKey, string>(document, x => x.SomeContent, content);
|
var result = SUT.UpdateOne<T, TKey, string>(document, x => x.SomeContent, content);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result, GetTestName());
|
ClassicAssert.IsTrue(result, GetTestName());
|
||||||
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -376,10 +376,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.UpdateOneAsync<T, TKey, string>(document, x => x.SomeContent, content);
|
var result = await SUT.UpdateOneAsync<T, TKey, string>(document, x => x.SomeContent, content);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result, GetTestName());
|
ClassicAssert.IsTrue(result, GetTestName());
|
||||||
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -392,10 +392,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.UpdateOne<T, TKey, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);
|
var result = SUT.UpdateOne<T, TKey, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result, GetTestName());
|
ClassicAssert.IsTrue(result, GetTestName());
|
||||||
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -408,10 +408,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.UpdateOneAsync<T, TKey, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);
|
var result = await SUT.UpdateOneAsync<T, TKey, string>(x => x.Id.Equals(document.Id), x => x.SomeContent, content, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result, GetTestName());
|
ClassicAssert.IsTrue(result, GetTestName());
|
||||||
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument, GetTestName());
|
ClassicAssert.IsNotNull(updatedDocument, GetTestName());
|
||||||
Assert.AreEqual(content, updatedDocument.SomeContent, GetTestName());
|
Assert.That(updatedDocument.SomeContent, Is.EqualTo(content), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -431,13 +431,13 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.UpdateOneAsync<T, TKey>(document, updateDef);
|
var result = await SUT.UpdateOneAsync<T, TKey>(document, updateDef);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result);
|
ClassicAssert.IsTrue(result);
|
||||||
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument);
|
ClassicAssert.IsNotNull(updatedDocument);
|
||||||
Assert.AreEqual(childrenToAdd[0].Type, updatedDocument.Children[0].Type, GetTestName());
|
Assert.That(updatedDocument.Children[0].Type, Is.EqualTo(childrenToAdd[0].Type), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[0].Value, updatedDocument.Children[0].Value, GetTestName());
|
Assert.That(updatedDocument.Children[0].Value, Is.EqualTo(childrenToAdd[0].Value), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[1].Type, updatedDocument.Children[1].Type, GetTestName());
|
Assert.That(updatedDocument.Children[1].Type, Is.EqualTo(childrenToAdd[1].Type), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[1].Value, updatedDocument.Children[1].Value, GetTestName());
|
Assert.That(updatedDocument.Children[1].Value, Is.EqualTo(childrenToAdd[1].Value), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -457,13 +457,13 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.UpdateOne<T, TKey>(document, updateDef);
|
var result = SUT.UpdateOne<T, TKey>(document, updateDef);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsTrue(result);
|
ClassicAssert.IsTrue(result);
|
||||||
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
var updatedDocument = SUT.GetById<T, TKey>(document.Id, PartitionKey);
|
||||||
Assert.IsNotNull(updatedDocument);
|
ClassicAssert.IsNotNull(updatedDocument);
|
||||||
Assert.AreEqual(childrenToAdd[0].Type, updatedDocument.Children[0].Type, GetTestName());
|
Assert.That(updatedDocument.Children[0].Type, Is.EqualTo(childrenToAdd[0].Type), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[0].Value, updatedDocument.Children[0].Value, GetTestName());
|
Assert.That(updatedDocument.Children[0].Value, Is.EqualTo(childrenToAdd[0].Value), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[1].Type, updatedDocument.Children[1].Type, GetTestName());
|
Assert.That(updatedDocument.Children[1].Type, Is.EqualTo(childrenToAdd[1].Type), GetTestName());
|
||||||
Assert.AreEqual(childrenToAdd[1].Value, updatedDocument.Children[1].Value, GetTestName());
|
Assert.That(updatedDocument.Children[1].Value, Is.EqualTo(childrenToAdd[1].Value), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Update
|
#endregion Update
|
||||||
@@ -479,8 +479,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.DeleteOne<T, TKey>(document);
|
var result = SUT.DeleteOne<T, TKey>(document);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, result);
|
Assert.That(result, Is.EqualTo(1));
|
||||||
Assert.IsFalse(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -492,8 +492,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.DeleteOne<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);
|
var result = SUT.DeleteOne<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, result);
|
Assert.That(result, Is.EqualTo(1));
|
||||||
Assert.IsFalse(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -505,8 +505,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.DeleteOneAsync<T, TKey>(document);
|
var result = await SUT.DeleteOneAsync<T, TKey>(document);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, result);
|
Assert.That(result, Is.EqualTo(1));
|
||||||
Assert.IsFalse(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -518,8 +518,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.DeleteOneAsync<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);
|
var result = await SUT.DeleteOneAsync<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(1, result);
|
Assert.That(result, Is.EqualTo(1));
|
||||||
Assert.IsFalse(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T, TKey>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -533,8 +533,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.DeleteManyAsync<T, TKey>(e => e.SomeContent == criteria, PartitionKey);
|
var result = await SUT.DeleteManyAsync<T, TKey>(e => e.SomeContent == criteria, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result);
|
Assert.That(result, Is.EqualTo(5));
|
||||||
Assert.IsFalse(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -548,8 +548,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = await SUT.DeleteManyAsync<T, TKey>(documents);
|
var result = await SUT.DeleteManyAsync<T, TKey>(documents);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result);
|
Assert.That(result, Is.EqualTo(5));
|
||||||
Assert.IsFalse(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -563,8 +563,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.DeleteMany<T, TKey>(e => e.SomeContent == criteria, PartitionKey);
|
var result = SUT.DeleteMany<T, TKey>(e => e.SomeContent == criteria, PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result);
|
Assert.That(result, Is.EqualTo(5));
|
||||||
Assert.IsFalse(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -578,8 +578,8 @@ namespace IntegrationTests.Infrastructure
|
|||||||
// Act
|
// Act
|
||||||
var result = SUT.DeleteMany<T, TKey>(documents);
|
var result = SUT.DeleteMany<T, TKey>(documents);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result);
|
Assert.That(result, Is.EqualTo(5));
|
||||||
Assert.IsFalse(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
ClassicAssert.IsFalse(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Delete
|
#endregion Delete
|
||||||
@@ -606,10 +606,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
},
|
},
|
||||||
PartitionKey);
|
PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
Assert.AreEqual(someContent, result.SomeContent, GetTestName());
|
Assert.That(result.SomeContent, Is.EqualTo(someContent), GetTestName());
|
||||||
Assert.AreEqual(someDate.Minute, result.SomeDate.Minute, GetTestName());
|
Assert.That(result.SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());
|
||||||
Assert.AreEqual(someDate.Second, result.SomeDate.Second, GetTestName());
|
Assert.That(result.SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -632,10 +632,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
},
|
},
|
||||||
PartitionKey);
|
PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsNotNull(result, GetTestName());
|
ClassicAssert.IsNotNull(result, GetTestName());
|
||||||
Assert.AreEqual(someContent, result.SomeContent, GetTestName());
|
Assert.That(result.SomeContent, Is.EqualTo(someContent), GetTestName());
|
||||||
Assert.AreEqual(someDate.Minute, result.SomeDate.Minute, GetTestName());
|
Assert.That(result.SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());
|
||||||
Assert.AreEqual(someDate.Second, result.SomeDate.Second, GetTestName());
|
Assert.That(result.SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -662,10 +662,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
},
|
},
|
||||||
PartitionKey);
|
PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result.Count, GetTestName());
|
Assert.That(result.Count, Is.EqualTo(5), GetTestName());
|
||||||
Assert.AreEqual(someContent, result.First().SomeContent, GetTestName());
|
Assert.That(result.First().SomeContent, Is.EqualTo(someContent), GetTestName());
|
||||||
Assert.AreEqual(someDate.Minute, result.First().SomeDate.Minute, GetTestName());
|
Assert.That(result.First().SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());
|
||||||
Assert.AreEqual(someDate.Second, result.First().SomeDate.Second, GetTestName());
|
Assert.That(result.First().SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -692,10 +692,10 @@ namespace IntegrationTests.Infrastructure
|
|||||||
},
|
},
|
||||||
PartitionKey);
|
PartitionKey);
|
||||||
// Assert
|
// Assert
|
||||||
Assert.AreEqual(5, result.Count, GetTestName());
|
Assert.That(result.Count, Is.EqualTo(5), GetTestName());
|
||||||
Assert.AreEqual(someContent, result.First().SomeContent, GetTestName());
|
Assert.That(result.First().SomeContent, Is.EqualTo(someContent), GetTestName());
|
||||||
Assert.AreEqual(someDate.Minute, result.First().SomeDate.Minute, GetTestName());
|
Assert.That(result.First().SomeDate.Minute, Is.EqualTo(someDate.Minute), GetTestName());
|
||||||
Assert.AreEqual(someDate.Second, result.First().SomeDate.Second, GetTestName());
|
Assert.That(result.First().SomeDate.Second, Is.EqualTo(someDate.Second), GetTestName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Project
|
#endregion Project
|
||||||
|
|||||||
@@ -23,20 +23,5 @@ namespace IntegrationTests.Infrastructure
|
|||||||
{
|
{
|
||||||
MongoDbContext.DropCollection<TDocument>(partitionKey);
|
MongoDbContext.DropCollection<TDocument>(partitionKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the max of a property in a mongodb collections that is satisfying the filter.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The document type.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key.</typeparam>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : System.IEquatable<TKey>
|
|
||||||
{
|
|
||||||
return await GetCollection<TDocument, TKey>().Find(Builders<TDocument>.Filter.Where(filter))
|
|
||||||
.SortByDescending(orderByDescending)
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,146 +1,49 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="..\packages\NUnit3TestAdapter.4.0.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.4.0.0\build\net35\NUnit3TestAdapter.props')" />
|
|
||||||
<Import Project="..\packages\NUnit.3.13.2\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.2\build\NUnit.props')" />
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{A484A355-A015-40CC-9B35-A4E872421128}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>IntegrationTests</RootNamespace>
|
|
||||||
<AssemblyName>IntegrationTests</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<NuGetPackageImportStamp>
|
|
||||||
</NuGetPackageImportStamp>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Crc32C.NET, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Crc32C.NET.1.0.5.0\lib\net20\Crc32C.NET.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="DnsClient, Version=1.4.0.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\DnsClient.1.4.0\lib\net45\DnsClient.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="MongoDB.Bson, Version=2.13.2.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\MongoDB.Bson.2.13.2\lib\net452\MongoDB.Bson.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="MongoDB.Driver, Version=2.13.2.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\MongoDB.Driver.2.13.2\lib\net452\MongoDB.Driver.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="MongoDB.Driver.Core, Version=2.13.2.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\MongoDB.Driver.Core.2.13.2\lib\net452\MongoDB.Driver.Core.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="MongoDB.Libmongocrypt, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\MongoDB.Libmongocrypt.1.2.2\lib\net452\MongoDB.Libmongocrypt.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="MongoDbGenericRepository, Version=1.4.8.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\MongoDbGenericRepository.1.4.8\lib\net452\MongoDbGenericRepository.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="nunit.framework, Version=3.13.2.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\NUnit.3.13.2\lib\net45\nunit.framework.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SharpCompress, Version=0.23.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\SharpCompress.0.23.0\lib\net45\SharpCompress.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Snappy.NET, Version=1.1.1.8, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Snappy.NET.1.1.1.8\lib\net45\Snappy.NET.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Configuration" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="CRUDObjectIdTests.cs" />
|
|
||||||
<Compile Include="CRUDPartitionedTests.cs" />
|
|
||||||
<Compile Include="CRUDTKeyPartitionedCollectionNameAttributeTests.cs" />
|
|
||||||
<Compile Include="CRUDTests.cs" />
|
|
||||||
<Compile Include="CRUDPartitionedCollectionNameAttributeTests.cs" />
|
|
||||||
<Compile Include="CRUDTKeyPartitionedTests.cs" />
|
|
||||||
<Compile Include="CRUDTKeyTests.cs" />
|
|
||||||
<Compile Include="Infrastructure\BaseMongoDbRepositoryTests.cs" />
|
|
||||||
<Compile Include="Infrastructure\GlobalVariables.cs" />
|
|
||||||
<Compile Include="Infrastructure\ITestRepository.cs" />
|
|
||||||
<Compile Include="Infrastructure\MongoDbDocumentTestBase.cs" />
|
|
||||||
<Compile Include="Infrastructure\MongoDbTKeyDocumentTestBase.cs" />
|
|
||||||
<Compile Include="Infrastructure\RandomExtensions.cs" />
|
|
||||||
<Compile Include="Infrastructure\TestClasses.cs" />
|
|
||||||
<Compile Include="Infrastructure\TestRepository.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</None>
|
|
||||||
<None Include="libmongocrypt.dylib" />
|
|
||||||
<None Include="libmongocrypt.so" />
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="Core\Compression\Snappy\lib\win\snappy32.dll" />
|
|
||||||
<Content Include="Core\Compression\Snappy\lib\win\snappy64.dll" />
|
|
||||||
<Content Include="Core\Compression\Zstandard\lib\win\libzstd.dll" />
|
|
||||||
<Content Include="mongocrypt.dll" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<IsTestProject>true</IsTestProject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\MongoDB.Libmongocrypt.1.2.2\build\MongoDB.Libmongocrypt.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MongoDB.Libmongocrypt.1.2.2\build\MongoDB.Libmongocrypt.targets'))" />
|
|
||||||
<Error Condition="!Exists('..\packages\NUnit.3.13.2\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.2\build\NUnit.props'))" />
|
<ItemGroup>
|
||||||
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.4.0.0\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.4.0.0\build\net35\NUnit3TestAdapter.props'))" />
|
<PackageReference Include="AWSSDK.Core" Version="3.7.400.57" />
|
||||||
<Error Condition="!Exists('..\packages\MongoDB.Driver.Core.2.13.2\build\MongoDB.Driver.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MongoDB.Driver.Core.2.13.2\build\MongoDB.Driver.Core.targets'))" />
|
<PackageReference Include="coverlet.collector" Version="6.0.2">
|
||||||
</Target>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<Import Project="..\packages\MongoDB.Libmongocrypt.1.2.2\build\MongoDB.Libmongocrypt.targets" Condition="Exists('..\packages\MongoDB.Libmongocrypt.1.2.2\build\MongoDB.Libmongocrypt.targets')" />
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<Import Project="..\packages\MongoDB.Driver.Core.2.13.2\build\MongoDB.Driver.Core.targets" Condition="Exists('..\packages\MongoDB.Driver.Core.2.13.2\build\MongoDB.Driver.Core.targets')" />
|
</PackageReference>
|
||||||
</Project>
|
<PackageReference Include="Crc32.NET" Version="1.2.0" />
|
||||||
|
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||||
|
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
|
||||||
|
<PackageReference Include="NUnit" Version="4.2.2" />
|
||||||
|
<PackageReference Include="NUnit.Analyzers" Version="4.4.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||||
|
|
||||||
|
|
||||||
|
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.401.6" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="NUnit.Framework"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="App.config">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\CoreIntegrationTests\CoreIntegrationTests.csproj" />
|
||||||
|
<ProjectReference Include="..\MongoDbGenericRepository\MongoDbGenericRepository.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// Les informations générales relatives à un assembly dépendent de
|
|
||||||
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
|
|
||||||
// associées à un assembly.
|
|
||||||
[assembly: AssemblyTitle("IntegrationTests")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("IntegrationTests")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
|
|
||||||
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
|
|
||||||
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
|
|
||||||
[assembly: Guid("a484a355-a015-40cc-9b35-a4e872421128")]
|
|
||||||
|
|
||||||
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
|
|
||||||
//
|
|
||||||
// Version principale
|
|
||||||
// Version secondaire
|
|
||||||
// Numéro de build
|
|
||||||
// Révision
|
|
||||||
//
|
|
||||||
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
|
|
||||||
// en utilisant '*', comme indiqué ci-dessous :
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,24 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Crc32C.NET" version="1.0.5.0" targetFramework="net461" />
|
|
||||||
<package id="DnsClient" version="1.4.0" targetFramework="net461" />
|
|
||||||
<package id="MongoDB.Bson" version="2.13.2" targetFramework="net461" />
|
|
||||||
<package id="MongoDB.Driver" version="2.13.2" targetFramework="net461" />
|
|
||||||
<package id="MongoDB.Driver.Core" version="2.13.2" targetFramework="net461" />
|
|
||||||
<package id="MongoDB.Libmongocrypt" version="1.2.2" targetFramework="net461" />
|
|
||||||
<package id="MongoDbGenericRepository" version="1.4.8" targetFramework="net461" />
|
|
||||||
<package id="NUnit" version="3.13.2" targetFramework="net461" />
|
|
||||||
<package id="NUnit.ConsoleRunner" version="3.12.0" targetFramework="net461" />
|
|
||||||
<package id="NUnit3TestAdapter" version="4.0.0" targetFramework="net461" />
|
|
||||||
<package id="SharpCompress" version="0.23.0" targetFramework="net461" />
|
|
||||||
<package id="Snappy.NET" version="1.1.1.8" targetFramework="net461" />
|
|
||||||
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
|
|
||||||
<package id="System.Net.Http" version="4.3.4" targetFramework="net461" />
|
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net461" />
|
|
||||||
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
|
|
||||||
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
|
|
||||||
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
|
|
||||||
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
|
|
||||||
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
|
|
||||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
|
|
||||||
</packages>
|
|
||||||
@@ -3,24 +3,20 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26730.12
|
VisualStudioVersion = 15.0.26730.12
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests", "IntegrationTests\IntegrationTests.csproj", "{A484A355-A015-40CC-9B35-A4E872421128}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoDbGenericRepository", "MongoDbGenericRepository\MongoDbGenericRepository.csproj", "{EFC776C4-2AF3-440C-BE80-3FBE335817A5}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoDbGenericRepository", "MongoDbGenericRepository\MongoDbGenericRepository.csproj", "{EFC776C4-2AF3-440C-BE80-3FBE335817A5}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreIntegrationTests", "CoreIntegrationTests\CoreIntegrationTests.csproj", "{C640C106-7A25-4E49-A0CF-E4F248E5A97F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreIntegrationTests", "CoreIntegrationTests\CoreIntegrationTests.csproj", "{C640C106-7A25-4E49-A0CF-E4F248E5A97F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreUnitTests", "CoreUnitTests\CoreUnitTests.csproj", "{8BE513ED-84F4-47E1-946D-84958CF95E6B}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreUnitTests", "CoreUnitTests\CoreUnitTests.csproj", "{8BE513ED-84F4-47E1-946D-84958CF95E6B}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests", "IntegrationTests\IntegrationTests.csproj", "{B3146094-8062-45C4-8FF9-4E1CBDDCAB59}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{A484A355-A015-40CC-9B35-A4E872421128}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{A484A355-A015-40CC-9B35-A4E872421128}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{A484A355-A015-40CC-9B35-A4E872421128}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{A484A355-A015-40CC-9B35-A4E872421128}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{EFC776C4-2AF3-440C-BE80-3FBE335817A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{EFC776C4-2AF3-440C-BE80-3FBE335817A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{EFC776C4-2AF3-440C-BE80-3FBE335817A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{EFC776C4-2AF3-440C-BE80-3FBE335817A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{EFC776C4-2AF3-440C-BE80-3FBE335817A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{EFC776C4-2AF3-440C-BE80-3FBE335817A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@@ -33,6 +29,10 @@ Global
|
|||||||
{8BE513ED-84F4-47E1-946D-84958CF95E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{8BE513ED-84F4-47E1-946D-84958CF95E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{8BE513ED-84F4-47E1-946D-84958CF95E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{8BE513ED-84F4-47E1-946D-84958CF95E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{8BE513ED-84F4-47E1-946D-84958CF95E6B}.Release|Any CPU.Build.0 = Release|Any CPU
|
{8BE513ED-84F4-47E1-946D-84958CF95E6B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B3146094-8062-45C4-8FF9-4E1CBDDCAB59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B3146094-8062-45C4-8FF9-4E1CBDDCAB59}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B3146094-8062-45C4-8FF9-4E1CBDDCAB59}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B3146094-8062-45C4-8FF9-4E1CBDDCAB59}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using MongoDB.Driver.Linq;
|
using MongoDB.Driver.Linq;
|
||||||
using MongoDbGenericRepository.Models;
|
using MongoDbGenericRepository.Models;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace MongoDbGenericRepository.DataAccess.Base
|
namespace MongoDbGenericRepository.DataAccess.Base
|
||||||
@@ -35,7 +36,7 @@ namespace MongoDbGenericRepository.DataAccess.Base
|
|||||||
/// <param name="filter">The filter definition.</param>
|
/// <param name="filter">The filter definition.</param>
|
||||||
/// <param name="partitionKey">The collection partition key.</param>
|
/// <param name="partitionKey">The collection partition key.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual IMongoQueryable<TDocument> GetQuery<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)
|
public virtual IQueryable<TDocument> GetQuery<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)
|
||||||
where TDocument : IDocument<TKey>
|
where TDocument : IDocument<TKey>
|
||||||
where TKey : IEquatable<TKey>
|
where TKey : IEquatable<TKey>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using MongoDB.Driver.Linq;
|
using MongoDB.Driver.Linq;
|
||||||
@@ -19,7 +20,7 @@ namespace MongoDbGenericRepository.DataAccess.Base
|
|||||||
/// <param name="filter">The filter definition.</param>
|
/// <param name="filter">The filter definition.</param>
|
||||||
/// <param name="partitionKey">The collection partition key.</param>
|
/// <param name="partitionKey">The collection partition key.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IMongoQueryable<TDocument> GetQuery<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)
|
IQueryable<TDocument> GetQuery<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)
|
||||||
where TDocument : IDocument<TKey>
|
where TDocument : IDocument<TKey>
|
||||||
where TKey : IEquatable<TKey>;
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using MongoDB.Bson.Serialization;
|
||||||
|
|
||||||
|
namespace MongoDbGenericRepository.Internals
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="IBsonSerializationProvider"/> that can handle multiple serializer registration calls.
|
||||||
|
/// </summary>
|
||||||
|
internal class RepositorySerializationProvider : IBsonSerializationProvider
|
||||||
|
{
|
||||||
|
private static volatile RepositorySerializationProvider _instance;
|
||||||
|
private static readonly object LockObject = new object();
|
||||||
|
|
||||||
|
private readonly ConcurrentDictionary<Type, IBsonSerializer> _cache;
|
||||||
|
|
||||||
|
private RepositorySerializationProvider()
|
||||||
|
{
|
||||||
|
_cache = new ConcurrentDictionary<Type, IBsonSerializer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RepositorySerializationProvider Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
lock (LockObject)
|
||||||
|
{
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
_instance = new RepositorySerializationProvider();
|
||||||
|
BsonSerializer.RegisterSerializationProvider(_instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public IBsonSerializer GetSerializer(Type type)
|
||||||
|
{
|
||||||
|
if (type == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
return _cache.TryGetValue(type, out var serializer) ? serializer : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void RegisterSerializer<T>(IBsonSerializer<T> serializer) =>
|
||||||
|
RegisterSerializer(typeof(T), serializer);
|
||||||
|
|
||||||
|
internal void RegisterSerializer(Type type, IBsonSerializer serializer) =>
|
||||||
|
_cache.TryAdd(type, serializer);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,9 @@ using MongoDbGenericRepository.Attributes;
|
|||||||
using MongoDbGenericRepository.Utils;
|
using MongoDbGenericRepository.Utils;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using MongoDB.Bson;
|
||||||
|
using MongoDB.Bson.Serialization.Serializers;
|
||||||
|
using MongoDbGenericRepository.Internals;
|
||||||
|
|
||||||
namespace MongoDbGenericRepository
|
namespace MongoDbGenericRepository
|
||||||
{
|
{
|
||||||
@@ -21,7 +24,6 @@ namespace MongoDbGenericRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IMongoDatabase Database { get; }
|
public IMongoDatabase Database { get; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The constructor of the MongoDbContext, it needs an object implementing <see cref="IMongoDatabase"/>.
|
/// The constructor of the MongoDbContext, it needs an object implementing <see cref="IMongoDatabase"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -90,9 +92,13 @@ namespace MongoDbGenericRepository
|
|||||||
/// Sets the Guid representation of the MongoDB Driver.
|
/// Sets the Guid representation of the MongoDB Driver.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="guidRepresentation">The new value of the GuidRepresentation</param>
|
/// <param name="guidRepresentation">The new value of the GuidRepresentation</param>
|
||||||
public virtual void SetGuidRepresentation(MongoDB.Bson.GuidRepresentation guidRepresentation)
|
public virtual void SetGuidRepresentation(GuidRepresentation guidRepresentation)
|
||||||
{
|
{
|
||||||
MongoDefaults.GuidRepresentation = guidRepresentation;
|
// GuidRepresentation and GuidRepresentationMode will be removed in the next major release of the MongoDB Driver.
|
||||||
|
// We can safely replace this with RepositorySerializationProvider.Instance.RegisterSerializer once we upgrade to the next major release.
|
||||||
|
#pragma warning disable CS0618
|
||||||
|
RepositorySerializationProvider.Instance.RegisterSerializer(new GuidSerializer(guidRepresentation));
|
||||||
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -103,8 +109,8 @@ namespace MongoDbGenericRepository
|
|||||||
protected virtual string GetAttributeCollectionName<TDocument>()
|
protected virtual string GetAttributeCollectionName<TDocument>()
|
||||||
{
|
{
|
||||||
return (typeof(TDocument).GetTypeInfo()
|
return (typeof(TDocument).GetTypeInfo()
|
||||||
.GetCustomAttributes(typeof(CollectionNameAttribute))
|
.GetCustomAttributes(typeof(CollectionNameAttribute))
|
||||||
.FirstOrDefault() as CollectionNameAttribute)?.Name;
|
.FirstOrDefault() as CollectionNameAttribute)?.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -114,7 +120,7 @@ namespace MongoDbGenericRepository
|
|||||||
protected virtual void InitializeGuidRepresentation()
|
protected virtual void InitializeGuidRepresentation()
|
||||||
{
|
{
|
||||||
// by default, avoid legacy UUID representation: use Binary 0x04 subtype.
|
// by default, avoid legacy UUID representation: use Binary 0x04 subtype.
|
||||||
MongoDefaults.GuidRepresentation = MongoDB.Bson.GuidRepresentation.Standard;
|
SetGuidRepresentation(GuidRepresentation.Standard);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -143,4 +149,4 @@ namespace MongoDbGenericRepository
|
|||||||
return (typeof(TDocument).Name.Pluralize()).Camelize();
|
return (typeof(TDocument).Name.Pluralize()).Camelize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net472;netstandard2.0;</TargetFrameworks>
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageId>MongoDbGenericRepository</PackageId>
|
<PackageId>MongoDbGenericRepository</PackageId>
|
||||||
<PackageVersion>1.4.8</PackageVersion>
|
|
||||||
<Authors>Alexandre Spieser</Authors>
|
<Authors>Alexandre Spieser</Authors>
|
||||||
<PackageTitle>MongoDb Generic Repository</PackageTitle>
|
<PackageTitle>MongoDb Generic Repository</PackageTitle>
|
||||||
<Description>A generic repository implementation using the MongoDB C# Sharp 2.0 driver.</Description>
|
<Description>A generic repository implementation using the MongoDB C# Sharp 2.0 driver.</Description>
|
||||||
@@ -12,12 +10,13 @@
|
|||||||
<PackageProjectUrl>http://www.opensource.org/licenses/mit-license.php</PackageProjectUrl>
|
<PackageProjectUrl>http://www.opensource.org/licenses/mit-license.php</PackageProjectUrl>
|
||||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||||
<PackageReleaseNotes>Release notes are at https://github.com/alexandre-spieser/mongodb-generic-repository/releases </PackageReleaseNotes>
|
<PackageReleaseNotes>Release notes are at https://github.com/alexandre-spieser/mongodb-generic-repository/releases </PackageReleaseNotes>
|
||||||
<Copyright>Copyright 2021 (c) Alexandre Spieser. All rights reserved.</Copyright>
|
<Copyright>Copyright 2023 (c) Alexandre Spieser. All rights reserved.</Copyright>
|
||||||
<PackageTags>MongoDb Repository Generic NoSql</PackageTags>
|
<PackageTags>MongoDb Repository Generic NoSql</PackageTags>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Version>1.4.8</Version>
|
|
||||||
<RepositoryUrl>https://github.com/alexandre-spieser/mongodb-generic-repository</RepositoryUrl>
|
<RepositoryUrl>https://github.com/alexandre-spieser/mongodb-generic-repository</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
|
<LangVersion>7.3</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@@ -25,7 +24,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MongoDB.Driver" Version="2.15.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
|
||||||
|
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user