Browse Source

Move AbpInterceptionTestBase to Volo.Abp.Tests since it's independent from Castle.Core.

pull/96/head
Halil İbrahim Kalkan 9 years ago
parent
commit
a93de36f5b
  1. 2
      test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj
  2. 4
      test/Volo.Abp.Autofac.Tests/Volo/Abp/Autofac/AutofacTestModule.cs
  3. 3
      test/Volo.Abp.Autofac.Tests/Volo/Abp/Autofac/Interception/Autofac_Interception_Test.cs
  4. 4
      test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj
  5. 31
      test/Volo.Abp.Castle.Core.Tests/Volo/Abp/Castle/AbpCastleCoreTestModule.cs
  6. 24
      test/Volo.Abp.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs
  7. 5
      test/Volo.Abp.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs
  8. 2
      test/Volo.Abp.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor2.cs
  9. 5
      test/Volo.Abp.Tests/Volo/Abp/DynamicProxy/SimpleInterceptionTargetClass.cs
  10. 5
      test/Volo.Abp.Tests/Volo/Abp/DynamicProxy/SimpleSyncInterceptor.cs

2
test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj

@ -15,7 +15,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\AbpTestBase\AbpTestBase.csproj" />
<ProjectReference Include="..\Volo.Abp.Castle.Core.Tests\Volo.Abp.Castle.Core.Tests.csproj" />
<ProjectReference Include="..\Volo.Abp.Tests\Volo.Abp.Tests.csproj" />
</ItemGroup>
<ItemGroup>

4
test/Volo.Abp.Autofac.Tests/Volo/Abp/Autofac/AutofacTestModule.cs

@ -1,11 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Castle;
using Volo.Abp.Castle.DynamicProxy;
using Volo.Abp.Modularity;
namespace Volo.Abp.Autofac
{
[DependsOn(typeof(AbpAutofacModule), typeof(AbpCastleCoreTestModule))]
[DependsOn(typeof(AbpAutofacModule))]
public class AutofacTestModule : AbpModule
{
public override void ConfigureServices(IServiceCollection services)

3
test/Volo.Abp.Autofac.Tests/Volo/Abp/Autofac/Interception/Autofac_Interception_Test.cs

@ -1,10 +1,11 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Castle.DynamicProxy;
using Volo.Abp.DynamicProxy;
namespace Volo.Abp.Autofac.Interception
{
public class Autofac_Interception_Test : CastleInterceptionTestBase<AutofacTestModule>
public class Autofac_Interception_Test : AbpInterceptionTestBase<AutofacTestModule>
{
//TODO: Sımplify using autofac in tests!

4
test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj

@ -21,4 +21,8 @@
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<ItemGroup>
<Folder Include="Volo\Abp\Castle\" />
</ItemGroup>
</Project>

31
test/Volo.Abp.Castle.Core.Tests/Volo/Abp/Castle/AbpCastleCoreTestModule.cs

@ -1,31 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Castle.DynamicProxy;
using Volo.Abp.Modularity;
namespace Volo.Abp.Castle
{
[DependsOn(typeof(AbpCastleCoreModule))]
public class AbpCastleCoreTestModule : AbpModule
{
public override void PreConfigureServices(IServiceCollection services)
{
services.OnServiceRegistred(RegisterTestInterceptors);
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddAssemblyOf<AbpCastleCoreTestModule>();
}
private static void RegisterTestInterceptors(IOnServiceRegistredArgs registration)
{
//TODO: Create an attribute to add interceptors!
if (typeof(SimpleInterceptionTargetClass) == registration.ImplementationType)
{
registration.Interceptors.Add<SimpleAsyncInterceptor>();
registration.Interceptors.Add<SimpleSyncInterceptor>();
registration.Interceptors.Add<SimpleAsyncInterceptor2>();
}
}
}
}

24
test/Volo.Abp.Castle.Core.Tests/Volo/Abp/Castle/DynamicProxy/CastleInterceptionTestBase.cs → test/Volo.Abp.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs

@ -5,12 +5,30 @@ using Volo.Abp.Modularity;
using Volo.Abp.TestBase;
using Xunit;
namespace Volo.Abp.Castle.DynamicProxy
namespace Volo.Abp.DynamicProxy
{
//TODO: There is no Castle Dependency here.. We can move this base class directly to Volo.Abp.Tests
public abstract class CastleInterceptionTestBase<TStartupModule> : AbpIntegratedTest<TStartupModule>
public abstract class AbpInterceptionTestBase<TStartupModule> : AbpIntegratedTest<TStartupModule>
where TStartupModule : IAbpModule
{
protected override void BeforeAddApplication(IServiceCollection services)
{
services.AddTransient<SimpleAsyncInterceptor>();
services.AddTransient<SimpleSyncInterceptor>();
services.AddTransient<SimpleAsyncInterceptor2>();
services.AddTransient<SimpleInterceptionTargetClass>();
services.OnServiceRegistred(registration =>
{
//TODO: Create an attribute to add interceptors!
if (typeof(SimpleInterceptionTargetClass) == registration.ImplementationType)
{
registration.Interceptors.Add<SimpleAsyncInterceptor>();
registration.Interceptors.Add<SimpleSyncInterceptor>();
registration.Interceptors.Add<SimpleAsyncInterceptor2>();
}
});
}
[Fact]
public async Task Should_Intercept_Async_Method_Without_Return_Value()
{

5
test/Volo.Abp.Castle.Core.Tests/Volo/Abp/Castle/DynamicProxy/SimpleAsyncInterceptor.cs → test/Volo.Abp.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs

@ -1,11 +1,10 @@
using System.Threading.Tasks;
using Volo.Abp.DynamicProxy;
using Volo.Abp.TestBase.Logging;
using Volo.DependencyInjection;
namespace Volo.Abp.Castle.DynamicProxy
namespace Volo.Abp.DynamicProxy
{
public class SimpleAsyncInterceptor : AbpInterceptor, ITransientDependency
public class SimpleAsyncInterceptor : AbpInterceptor
{
public override void Intercept(IAbpMethodInvocation invocation)
{

2
test/Volo.Abp.Castle.Core.Tests/Volo/Abp/Castle/DynamicProxy/SimpleAsyncInterceptor2.cs → test/Volo.Abp.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor2.cs

@ -1,4 +1,4 @@
namespace Volo.Abp.Castle.DynamicProxy
namespace Volo.Abp.DynamicProxy
{
public class SimpleAsyncInterceptor2 : SimpleAsyncInterceptor
{

5
test/Volo.Abp.Castle.Core.Tests/Volo/Abp/Castle/DynamicProxy/SimpleInterceptionTargetClass.cs → test/Volo.Abp.Tests/Volo/Abp/DynamicProxy/SimpleInterceptionTargetClass.cs

@ -1,11 +1,10 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.TestBase.Logging;
using Volo.DependencyInjection;
namespace Volo.Abp.Castle.DynamicProxy
namespace Volo.Abp.DynamicProxy
{
public class SimpleInterceptionTargetClass : ITransientDependency, ICanLogOnObject
public class SimpleInterceptionTargetClass : ICanLogOnObject
{
public List<string> Logs { get; } = new List<string>();

5
test/Volo.Abp.Castle.Core.Tests/Volo/Abp/Castle/DynamicProxy/SimpleSyncInterceptor.cs → test/Volo.Abp.Tests/Volo/Abp/DynamicProxy/SimpleSyncInterceptor.cs

@ -1,10 +1,9 @@
using Volo.Abp.DynamicProxy;
using Volo.Abp.TestBase.Logging;
using Volo.DependencyInjection;
namespace Volo.Abp.Castle.DynamicProxy
namespace Volo.Abp.DynamicProxy
{
public class SimpleSyncInterceptor : AbpInterceptor, ITransientDependency
public class SimpleSyncInterceptor : AbpInterceptor
{
public override void Intercept(IAbpMethodInvocation invocation)
{
Loading…
Cancel
Save