mirror of https://github.com/abpframework/abp.git
committed by
GitHub
9 changed files with 93 additions and 20 deletions
@ -0,0 +1,21 @@ |
|||||
|
using Shouldly; |
||||
|
using Volo.Abp.DynamicProxy; |
||||
|
using Volo.Abp.TestApp.Application; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc; |
||||
|
|
||||
|
public class ConventionalController_Tests : AspNetCoreMvcTestBase |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void Conventional_Controller_Should_Disable_DynamicProxy() |
||||
|
{ |
||||
|
// PeopleAppService is a conventional controller
|
||||
|
var peopleAppService = GetRequiredService<PeopleAppService>(); |
||||
|
ProxyHelper.IsProxy(peopleAppService).ShouldBeFalse(); |
||||
|
|
||||
|
// ConventionalAppService is not a conventional controller
|
||||
|
var conventionalAppService = GetRequiredService<ConventionalAppService>(); |
||||
|
ProxyHelper.IsProxy(conventionalAppService).ShouldBeTrue(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Uow; |
||||
|
|
||||
|
namespace Volo.Abp.TestApp.Application; |
||||
|
|
||||
|
public class ConventionalAppService : IApplicationService, ITransientDependency |
||||
|
{ |
||||
|
[Authorize] |
||||
|
[UnitOfWork] |
||||
|
public virtual Task GetAsync() |
||||
|
{ |
||||
|
return Task.CompletedTask; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue