Browse Source

Remove DDD dependency from validation tests.

pull/216/head
Halil İbrahim Kalkan 9 years ago
parent
commit
01997f7c6c
  1. 1
      test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj
  2. 17
      test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs

1
test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj

@ -13,7 +13,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" /> <ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Ddd\Volo.Abp.Ddd.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" /> <ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\..\src\Volo.Abp.Validation\Volo.Abp.Validation.csproj" /> <ProjectReference Include="..\..\src\Volo.Abp.Validation\Volo.Abp.Validation.csproj" />
</ItemGroup> </ItemGroup>

17
test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs

@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection;
using Shouldly; using Shouldly;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.TestBase; using Volo.Abp.TestBase;
using Xunit; using Xunit;
@ -148,16 +149,26 @@ namespace Volo.Abp.Validation
[DependsOn(typeof(AbpAutofacModule))] [DependsOn(typeof(AbpAutofacModule))]
[DependsOn(typeof(AbpValidationModule))] [DependsOn(typeof(AbpValidationModule))]
[DependsOn(typeof(AbpDddModule))]
public class TestModule : AbpModule public class TestModule : AbpModule
{ {
public override void PreConfigureServices(IServiceCollection services)
{
services.OnRegistred(context =>
{
if (typeof(IMyAppService).IsAssignableFrom(context.ImplementationType))
{
context.Interceptors.TryAdd<ValidationInterceptor>();
}
});
}
public override void ConfigureServices(IServiceCollection services) public override void ConfigureServices(IServiceCollection services)
{ {
services.AddType<MyAppService>(); services.AddType<MyAppService>();
} }
} }
public interface IMyAppService : IApplicationService public interface IMyAppService
{ {
MyMethodOutput MyMethod(MyMethodInput input); MyMethodOutput MyMethod(MyMethodInput input);
MyMethodOutput MyMethod2(MyMethod2Input input); MyMethodOutput MyMethod2(MyMethod2Input input);
@ -170,7 +181,7 @@ namespace Volo.Abp.Validation
void MyMethodWithNullableEnum(MyEnum? value); void MyMethodWithNullableEnum(MyEnum? value);
} }
public class MyAppService : ApplicationService, IMyAppService public class MyAppService : IMyAppService, ITransientDependency
{ {
public MyMethodOutput MyMethod(MyMethodInput input) public MyMethodOutput MyMethod(MyMethodInput input)
{ {

Loading…
Cancel
Save