mirror of https://github.com/abpframework/abp.git
4 changed files with 74 additions and 7 deletions
@ -0,0 +1,24 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netcoreapp2.1</TargetFramework> |
||||
|
<AssemblyName>Volo.Abp.AuditLogging.MongoDB.Tests</AssemblyName> |
||||
|
<PackageId>Volo.Abp.AuditLogging.MongoDB.Tests</PackageId> |
||||
|
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> |
||||
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
||||
|
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
||||
|
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\src\Volo.Abp.AuditLogging.MongoDB\Volo.Abp.AuditLogging.MongoDB.csproj" /> |
||||
|
<ProjectReference Include="..\Volo.Abp.AuditLogging.TestBase\Volo.Abp.AuditLogging.TestBase.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" /> |
||||
|
<PackageReference Include="Mongo2Go" Version="2.2.1" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,34 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Mongo2Go; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace Volo.Abp.AuditLogging.MongoDB |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpAuditLoggingTestBaseModule), |
||||
|
typeof(AbpAuditLoggingMongoDbModule) |
||||
|
)] |
||||
|
public class AbpAuditLoggingMongoDbTestModule : AbpModule |
||||
|
{ |
||||
|
private MongoDbRunner _mongoDbRunner; |
||||
|
|
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
_mongoDbRunner = MongoDbRunner.Start(); |
||||
|
|
||||
|
context.Services.Configure<DbConnectionOptions>(options => |
||||
|
{ |
||||
|
options.ConnectionStrings.Default = _mongoDbRunner.ConnectionString; |
||||
|
}); |
||||
|
|
||||
|
context.Services.AddAssemblyOf<AbpAuditLoggingMongoDbTestModule>(); |
||||
|
} |
||||
|
|
||||
|
public override void OnApplicationShutdown(ApplicationShutdownContext context) |
||||
|
{ |
||||
|
_mongoDbRunner.Dispose(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue