diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 8885fa6..fa8c583 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,15 +1,57 @@
version: 2
updates:
-- package-ecosystem: "github-actions"
- directory: "/"
- schedule:
- interval: daily
- time: "01:00"
- open-pull-requests-limit: 10
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: daily
+ time: "01:00"
+ timezone: "America/Chicago"
+ open-pull-requests-limit: 10
-- package-ecosystem: nuget
- directory: "/"
- schedule:
- interval: daily
- time: "11:00"
- open-pull-requests-limit: 10
+ - package-ecosystem: nuget
+ directory: "/"
+ schedule:
+ interval: daily
+ time: "02:00"
+ timezone: "America/Chicago"
+ open-pull-requests-limit: 10
+ groups:
+ Azure:
+ patterns:
+ - "Azure.*"
+ - "Microsoft.Azure.*"
+ - "Microsoft.Extensions.Azure"
+ AspNetCoreHealthChecks:
+ patterns:
+ - "AspNetCore.HealthChecks.*"
+ AspNetCore:
+ patterns:
+ - "Microsoft.AspNetCore.*"
+ - "Microsoft.Extensions.Features"
+ MicrosoftExtensions:
+ patterns:
+ - "Microsoft.Extensions.*"
+ EntityFrameworkCore:
+ patterns:
+ - "Microsoft.EntityFrameworkCore.*"
+ OpenTelemetry:
+ patterns:
+ - "OpenTelemetry.*"
+ Serilog:
+ patterns:
+ - "Serilog"
+ - "Serilog.*"
+ Hangfire:
+ patterns:
+ - "Hangfire"
+ - "Hangfire.*"
+ Testcontainers:
+ patterns:
+ - "Testcontainers.*"
+ xUnit:
+ patterns:
+ - "xunit"
+ - "xunit.assert"
+ - "xunit.core"
+ - "xunit.extensibility.*"
+ - "xunit.runner.*"
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 80765a7..11d079a 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -3,7 +3,9 @@ name: Build
env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- BUILD_PATH: '${{github.workspace}}/artifacts'
+ DOTNET_ENVIRONMENT: github
+ ASPNETCORE_ENVIRONMENT: github
+ BUILD_PATH: "${{github.workspace}}/artifacts"
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
on:
@@ -12,14 +14,13 @@ on:
- master
- develop
tags:
- - 'v*'
+ - "v*"
pull_request:
branches:
- master
- develop
jobs:
-
build:
runs-on: ubuntu-latest
@@ -27,57 +28,48 @@ jobs:
mongodb:
image: mongo:latest
ports:
- - 27017:27017
+ - 27017:27017
volumes:
- - mongo_data:/data/db
- - mongo_config:/data/configdb
+ - mongo_data:/data/db
+ - mongo_config:/data/configdb
steps:
- - name: Checkout
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Install .NET Core
- uses: actions/setup-dotnet@v3
- with:
- dotnet-version: |
- 6.0.x
- 7.0.x
-
- - name: Restore Dependencies
- run: dotnet restore
-
- - name: Build Solution
- run: dotnet build --no-restore --configuration Release
-
- - name: Run Test
- run: dotnet test --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings
-
- - name: Generate Coverage
- uses: danielpalme/ReportGenerator-GitHub-Action@5.1.23
- with:
- reports: '${{github.workspace}}/test/*/TestResults/*/coverage.info'
- targetdir: ${{env.BUILD_PATH}}
- reporttypes: lcov
-
- - name: Report Coverage
- if: success()
- uses: coverallsapp/github-action@v2
- with:
- file: artifacts/lcov.info
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Install .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: 8.0.x
+
+ - name: Restore Dependencies
+ run: dotnet restore
+
+ - name: Build Solution
+ run: dotnet build --no-restore --configuration Release
+
+ - name: Run Test
+ run: dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --settings coverlet.runsettings
+
+ - name: Report Coverage
+ if: success()
+ uses: coverallsapp/github-action@v2
+ with:
+ file: "${{github.workspace}}/test/*/TestResults/*/coverage.info"
format: lcov
- - name: Create Packages
- if: success() && github.event_name != 'pull_request'
- run: dotnet pack --configuration Release --include-symbols --include-source --no-build --no-restore --output "${{env.BUILD_PATH}}"
+ - name: Create Packages
+ if: success() && github.event_name != 'pull_request'
+ run: dotnet pack --configuration Release --no-build --output "${{env.BUILD_PATH}}"
- - name: Upload Packages
- if: success() && github.event_name != 'pull_request'
- uses: actions/upload-artifact@v3
- with:
- name: packages
- path: '${{env.BUILD_PATH}}'
+ - name: Upload Packages
+ if: success() && github.event_name != 'pull_request'
+ uses: actions/upload-artifact@v4
+ with:
+ name: packages
+ path: "${{env.BUILD_PATH}}"
deploy:
runs-on: ubuntu-latest
@@ -85,30 +77,29 @@ jobs:
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
steps:
- - name: Download Artifact
- uses: actions/download-artifact@v3
- with:
- name: packages
-
- - name: Publish Packages GitHub
- run: |
- for package in $(find -name "*.nupkg"); do
- echo "${0##*/}": Pushing $package...
- dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
- done
-
- - name: Publish Packages feedz
- run: |
- for package in $(find -name "*.nupkg"); do
- echo "${0##*/}": Pushing $package...
- dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate
- done
-
- - name: Publish Packages Nuget
- if: startsWith(github.ref, 'refs/tags/v')
- run: |
- for package in $(find -name "*.nupkg"); do
- echo "${0##*/}": Pushing $package...
- dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate
- done
-
+ - name: Download Artifact
+ uses: actions/download-artifact@v4
+ with:
+ name: packages
+
+ - name: Publish Packages GitHub
+ run: |
+ for package in $(find -name "*.nupkg"); do
+ echo "${0##*/}": Pushing $package...
+ dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
+ done
+
+ - name: Publish Packages feedz
+ run: |
+ for package in $(find -name "*.nupkg"); do
+ echo "${0##*/}": Pushing $package...
+ dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate
+ done
+
+ - name: Publish Packages Nuget
+ if: startsWith(github.ref, 'refs/tags/v')
+ run: |
+ for package in $(find -name "*.nupkg"); do
+ echo "${0##*/}": Pushing $package...
+ dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate
+ done
diff --git a/MongoDB.Abstracts.sln b/MongoDB.Abstracts.sln
index 1876ec6..03d8516 100644
--- a/MongoDB.Abstracts.sln
+++ b/MongoDB.Abstracts.sln
@@ -12,10 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{AEBC64A5
coverlet.runsettings = coverlet.runsettings
src\Directory.Build.props = src\Directory.Build.props
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C480AF26-E87F-4ACA-9F34-047BDAE3A769}"
- ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
diff --git a/coverlet.runsettings b/coverlet.runsettings
index 4eac22c..b28750f 100644
--- a/coverlet.runsettings
+++ b/coverlet.runsettings
@@ -5,8 +5,6 @@
lcov
- Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute,TestSDKAutoGeneratedCode
- true
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index da4777f..77c95f0 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -16,14 +16,18 @@
true
-
- portable
- true
- true
- snupkg
+
+ embedded
+ true
+ false
-
+
+ true
+
+
+
+ en-US
latest
enable
1591
@@ -32,10 +36,9 @@
v
-
+
-
-
+
diff --git a/src/MongoDB.Abstracts/MongoDB.Abstracts.csproj b/src/MongoDB.Abstracts/MongoDB.Abstracts.csproj
index 62eb37e..ea0c9ac 100644
--- a/src/MongoDB.Abstracts/MongoDB.Abstracts.csproj
+++ b/src/MongoDB.Abstracts/MongoDB.Abstracts.csproj
@@ -1,12 +1,10 @@
- net472;netstandard2.0;netstandard2.1
- true
- MongoDB.Abstracts
+ netstandard2.0;netstandard2.1
-
+
\ No newline at end of file
diff --git a/src/MongoDB.Abstracts/MongoQuery.cs b/src/MongoDB.Abstracts/MongoQuery.cs
index 57e0064..6739bcf 100644
--- a/src/MongoDB.Abstracts/MongoQuery.cs
+++ b/src/MongoDB.Abstracts/MongoQuery.cs
@@ -195,8 +195,7 @@ protected virtual IMongoCollection CreateCollection()
///
protected virtual IMongoCollection CreateCollection(IMongoDatabase database, string collectionName)
{
- var mongoCollection = database.GetCollection(collectionName);
- return mongoCollection;
+ return database.GetCollection(collectionName);
}
///
diff --git a/test/MongoDB.Abstracts.Tests/CommentRepositoryTest.cs b/test/MongoDB.Abstracts.Tests/CommentRepositoryTest.cs
index e3007e3..368d839 100644
--- a/test/MongoDB.Abstracts.Tests/CommentRepositoryTest.cs
+++ b/test/MongoDB.Abstracts.Tests/CommentRepositoryTest.cs
@@ -1,24 +1,17 @@
using System.Linq;
using System.Threading.Tasks;
-using Bogus;
-
-using FluentAssertions;
-
using Microsoft.Extensions.DependencyInjection;
using MongoDB.Abstracts.Tests.Models;
using MongoDB.Bson;
-using Xunit;
-using Xunit.Abstractions;
-
namespace MongoDB.Abstracts.Tests;
-public class CommentRepositoryTest : TestServiceBase
+public class CommentRepositoryTest : DatabaseTestBase
{
- public CommentRepositoryTest(ITestOutputHelper outputHelper) : base(outputHelper)
+ public CommentRepositoryTest(ITestOutputHelper output, DatabaseFixture databaseFixture) : base(output, databaseFixture)
{
}
diff --git a/test/MongoDB.Abstracts.Tests/DatabaseCollection.cs b/test/MongoDB.Abstracts.Tests/DatabaseCollection.cs
new file mode 100644
index 0000000..5364e40
--- /dev/null
+++ b/test/MongoDB.Abstracts.Tests/DatabaseCollection.cs
@@ -0,0 +1,7 @@
+namespace MongoDB.Abstracts.Tests;
+
+[CollectionDefinition(CollectionName)]
+public class DatabaseCollection : ICollectionFixture
+{
+ public const string CollectionName = "DatabaseCollection";
+}
diff --git a/test/MongoDB.Abstracts.Tests/DatabaseFixture.cs b/test/MongoDB.Abstracts.Tests/DatabaseFixture.cs
new file mode 100644
index 0000000..bd52c17
--- /dev/null
+++ b/test/MongoDB.Abstracts.Tests/DatabaseFixture.cs
@@ -0,0 +1,29 @@
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+
+using XUnit.Hosting;
+
+namespace MongoDB.Abstracts.Tests;
+
+public class DatabaseFixture : TestApplicationFixture
+{
+ protected override void ConfigureApplication(HostApplicationBuilder builder)
+ {
+ base.ConfigureApplication(builder);
+
+ var services = builder.Services;
+
+ services.AddSingleton(sp =>
+ {
+ var configuration = sp.GetRequiredService();
+ var connectionString = configuration.GetConnectionString("MongoUnitTest");
+ return MongoFactory.GetDatabaseFromConnectionString(connectionString);
+ });
+
+ services.AddSingleton(typeof(IMongoEntityQuery<>), typeof(MongoEntityQuery<>));
+ services.AddSingleton(typeof(IMongoEntityRepository<>), typeof(MongoEntityRepository<>));
+
+ services.AddMongoDBAbstractsTests();
+ }
+}
diff --git a/test/MongoDB.Abstracts.Tests/DatabaseTestBase.cs b/test/MongoDB.Abstracts.Tests/DatabaseTestBase.cs
new file mode 100644
index 0000000..0ba0bd7
--- /dev/null
+++ b/test/MongoDB.Abstracts.Tests/DatabaseTestBase.cs
@@ -0,0 +1,16 @@
+using System;
+
+using XUnit.Hosting;
+
+namespace MongoDB.Abstracts.Tests;
+
+[Collection(DatabaseCollection.CollectionName)]
+public abstract class DatabaseTestBase : TestHostBase
+{
+ protected DatabaseTestBase(ITestOutputHelper output, DatabaseFixture databaseFixture)
+ : base(output, databaseFixture)
+ {
+ }
+
+ public IServiceProvider ServiceProvider => Fixture.Services;
+}
diff --git a/test/MongoDB.Abstracts.Tests/EntryRepositoryTest.cs b/test/MongoDB.Abstracts.Tests/EntryRepositoryTest.cs
index 6beb124..f8ea179 100644
--- a/test/MongoDB.Abstracts.Tests/EntryRepositoryTest.cs
+++ b/test/MongoDB.Abstracts.Tests/EntryRepositoryTest.cs
@@ -2,35 +2,19 @@
using System.Linq;
using System.Threading.Tasks;
-using FluentAssertions;
-
using Microsoft.Extensions.DependencyInjection;
using MongoDB.Abstracts.Tests.Models;
using MongoDB.Abstracts.Tests.Services;
using MongoDB.Driver;
-using Xunit;
-using Xunit.Abstractions;
-
namespace MongoDB.Abstracts.Tests;
-public class EntryRepositoryTest : TestServiceBase
+public class EntryRepositoryTest : DatabaseTestBase
{
- public EntryRepositoryTest(ITestOutputHelper outputHelper) : base(outputHelper)
- {
- }
-
- protected override void ConfigureServices(IServiceCollection services)
+ public EntryRepositoryTest(ITestOutputHelper output, DatabaseFixture databaseFixture) : base(output, databaseFixture)
{
- base.ConfigureServices(services);
-
- services.Scan(scan => scan
- .FromAssemblyOf()
- .AddClasses(classes => classes.AssignableTo(typeof(IMongoQuery<,>))).AsImplementedInterfaces().AsSelf()
- .WithSingletonLifetime()
- );
}
[Fact]
diff --git a/test/MongoDB.Abstracts.Tests/ItemRepositoryTest.cs b/test/MongoDB.Abstracts.Tests/ItemRepositoryTest.cs
index f56181e..e65ebca 100644
--- a/test/MongoDB.Abstracts.Tests/ItemRepositoryTest.cs
+++ b/test/MongoDB.Abstracts.Tests/ItemRepositoryTest.cs
@@ -1,24 +1,17 @@
using System.Linq;
using System.Threading.Tasks;
-using Bogus;
-
-using FluentAssertions;
-
using Microsoft.Extensions.DependencyInjection;
using MongoDB.Abstracts.Tests.Models;
using MongoDB.Bson;
-using Xunit;
-using Xunit.Abstractions;
-
namespace MongoDB.Abstracts.Tests;
-public class ItemRepositoryTest : TestServiceBase
+public class ItemRepositoryTest : DatabaseTestBase
{
- public ItemRepositoryTest(ITestOutputHelper outputHelper) : base(outputHelper)
+ public ItemRepositoryTest(ITestOutputHelper output, DatabaseFixture databaseFixture) : base(output, databaseFixture)
{
}
diff --git a/test/MongoDB.Abstracts.Tests/MongoDB.Abstracts.Tests.csproj b/test/MongoDB.Abstracts.Tests/MongoDB.Abstracts.Tests.csproj
index 80f7f3e..55dbf9b 100644
--- a/test/MongoDB.Abstracts.Tests/MongoDB.Abstracts.Tests.csproj
+++ b/test/MongoDB.Abstracts.Tests/MongoDB.Abstracts.Tests.csproj
@@ -1,44 +1,49 @@
-
- net7.0
- false
-
+
+ net8.0
+ false
+
-
-
-
-
-
+
+
+
+
+
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
-
-
-
+
+
+
+
+
+
+ Always
+
+
+
+
+
+
+
+
+
+
-
-
- Always
-
-
\ No newline at end of file
diff --git a/test/MongoDB.Abstracts.Tests/RoleRepositoryTest.cs b/test/MongoDB.Abstracts.Tests/RoleRepositoryTest.cs
index abe61d2..12dbf49 100644
--- a/test/MongoDB.Abstracts.Tests/RoleRepositoryTest.cs
+++ b/test/MongoDB.Abstracts.Tests/RoleRepositoryTest.cs
@@ -2,22 +2,17 @@
using System.Linq;
using System.Threading.Tasks;
-using FluentAssertions;
-
using Microsoft.Extensions.DependencyInjection;
using MongoDB.Abstracts.Tests.Models;
using MongoDB.Bson;
-using Xunit;
-using Xunit.Abstractions;
-
namespace MongoDB.Abstracts.Tests;
-public class RoleRepositoryTest : TestServiceBase
+public class RoleRepositoryTest : DatabaseTestBase
{
- public RoleRepositoryTest(ITestOutputHelper outputHelper) : base(outputHelper)
+ public RoleRepositoryTest(ITestOutputHelper output, DatabaseFixture databaseFixture) : base(output, databaseFixture)
{
}
diff --git a/test/MongoDB.Abstracts.Tests/Services/EntryRepository.cs b/test/MongoDB.Abstracts.Tests/Services/EntryRepository.cs
index 4365d5c..aa65afd 100644
--- a/test/MongoDB.Abstracts.Tests/Services/EntryRepository.cs
+++ b/test/MongoDB.Abstracts.Tests/Services/EntryRepository.cs
@@ -4,6 +4,7 @@
namespace MongoDB.Abstracts.Tests.Services;
+[RegisterSingleton]
public class EntryRepository : MongoEntityRepository, IEntryRepository
{
public EntryRepository(IMongoDatabase mongoDatabase) : base(mongoDatabase)
diff --git a/test/MongoDB.Abstracts.Tests/Services/UserRepository.cs b/test/MongoDB.Abstracts.Tests/Services/UserRepository.cs
index 9fcdce0..e4976e8 100644
--- a/test/MongoDB.Abstracts.Tests/Services/UserRepository.cs
+++ b/test/MongoDB.Abstracts.Tests/Services/UserRepository.cs
@@ -4,6 +4,7 @@
namespace MongoDB.Abstracts.Tests.Services;
+[RegisterSingleton]
public class UserRepository : MongoEntityRepository, IUserRepository
{
public UserRepository(IMongoDatabase mongoDatabase) : base(mongoDatabase)
diff --git a/test/MongoDB.Abstracts.Tests/TemplateRepositoryTest.cs b/test/MongoDB.Abstracts.Tests/TemplateRepositoryTest.cs
index b5e9002..096c78c 100644
--- a/test/MongoDB.Abstracts.Tests/TemplateRepositoryTest.cs
+++ b/test/MongoDB.Abstracts.Tests/TemplateRepositoryTest.cs
@@ -1,23 +1,16 @@
using System.Linq;
using System.Threading.Tasks;
-using Bogus;
-
-using FluentAssertions;
-
using Microsoft.Extensions.DependencyInjection;
using MongoDB.Abstracts.Tests.Models;
using MongoDB.Bson;
-using Xunit;
-using Xunit.Abstractions;
-
namespace MongoDB.Abstracts.Tests;
-public class TemplateRepositoryTest : TestServiceBase
+public class TemplateRepositoryTest : DatabaseTestBase
{
- public TemplateRepositoryTest(ITestOutputHelper outputHelper) : base(outputHelper)
+ public TemplateRepositoryTest(ITestOutputHelper output, DatabaseFixture databaseFixture) : base(output, databaseFixture)
{
}
diff --git a/test/MongoDB.Abstracts.Tests/TestServiceBase.cs b/test/MongoDB.Abstracts.Tests/TestServiceBase.cs
deleted file mode 100644
index 1023d0f..0000000
--- a/test/MongoDB.Abstracts.Tests/TestServiceBase.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System;
-
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-
-using Xunit.Abstractions;
-
-namespace MongoDB.Abstracts.Tests;
-
-public abstract class TestServiceBase
-{
- protected ITestOutputHelper OutputHelper { get; }
- protected IConfiguration Configuration { get; }
- protected IServiceProvider Services { get; }
-
- protected TestServiceBase(ITestOutputHelper outputHelper)
- {
- OutputHelper = outputHelper;
-
- var builder = new ConfigurationBuilder();
- Configure(builder);
-
- Configuration = builder.Build();
-
- var services = new ServiceCollection();
- ConfigureServices(services);
-
- Services = services.BuildServiceProvider();
- }
-
- protected virtual void Configure(IConfigurationBuilder configuration)
- {
- var enviromentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Test";
-
- configuration
- .AddJsonFile("appsettings.json")
- .AddJsonFile($"appsettings.{enviromentName}.json", true)
- .AddEnvironmentVariables();
- }
-
- protected virtual void ConfigureServices(IServiceCollection services)
- {
- services
- .AddSingleton(Configuration)
- .AddLogging((builder) => builder
- .AddXUnit(OutputHelper)
- .SetMinimumLevel(LogLevel.Debug)
- )
- .AddSingleton(provider =>
- {
- var configuration = provider.GetRequiredService();
- var connectionString = configuration.GetConnectionString("MongoUnitTest");
-
- return MongoFactory.GetDatabaseFromConnectionString(connectionString);
- })
- .AddSingleton(typeof(IMongoEntityQuery<>), typeof(MongoEntityQuery<>))
- .AddSingleton(typeof(IMongoEntityRepository<>), typeof(MongoEntityRepository<>));
- }
-}
diff --git a/test/MongoDB.Abstracts.Tests/UserRepositoryTest.cs b/test/MongoDB.Abstracts.Tests/UserRepositoryTest.cs
index f1e4df5..d87385b 100644
--- a/test/MongoDB.Abstracts.Tests/UserRepositoryTest.cs
+++ b/test/MongoDB.Abstracts.Tests/UserRepositoryTest.cs
@@ -1,32 +1,16 @@
-using FluentAssertions;
-
using Microsoft.Extensions.DependencyInjection;
using MongoDB.Abstracts.Tests.Models;
using MongoDB.Abstracts.Tests.Services;
using MongoDB.Driver;
-using Xunit;
-using Xunit.Abstractions;
-
namespace MongoDB.Abstracts.Tests;
-public class UserRepositoryTest : TestServiceBase
+public class UserRepositoryTest : DatabaseTestBase
{
- public UserRepositoryTest(ITestOutputHelper outputHelper) : base(outputHelper)
- {
- }
-
- protected override void ConfigureServices(IServiceCollection services)
+ public UserRepositoryTest(ITestOutputHelper output, DatabaseFixture databaseFixture) : base(output, databaseFixture)
{
- base.ConfigureServices(services);
-
- services.Scan(scan => scan
- .FromAssemblyOf()
- .AddClasses(classes => classes.AssignableTo(typeof(IMongoQuery<,>))).AsImplementedInterfaces().AsSelf()
- .WithSingletonLifetime()
- );
}
[Fact]