mirror of https://github.com/abpframework/abp.git
committed by
GitHub
8 changed files with 171 additions and 20 deletions
@ -0,0 +1,22 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace Volo.Abp; |
||||
|
|
||||
|
[Flags] |
||||
|
public enum ApplicationServiceTypes : byte |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Only application services without <see cref="IntegrationServiceAttribute"/>.
|
||||
|
/// </summary>
|
||||
|
ApplicationServices = 1, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Application services with <see cref="IntegrationServiceAttribute"/>.
|
||||
|
/// </summary>
|
||||
|
IntegrationServices = 2, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// All application services.
|
||||
|
/// </summary>
|
||||
|
All = ApplicationServices | IntegrationServices |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
using Shouldly; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Abp; |
||||
|
|
||||
|
public class IntegrationServiceAttribute_Tests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public static void IsDefinedOrInherited() |
||||
|
{ |
||||
|
// True cases
|
||||
|
|
||||
|
IntegrationServiceAttribute |
||||
|
.IsDefinedOrInherited<IMyIntegrationService1>() |
||||
|
.ShouldBeTrue(); |
||||
|
|
||||
|
IntegrationServiceAttribute |
||||
|
.IsDefinedOrInherited<MyIntegrationService1>() |
||||
|
.ShouldBeTrue(); |
||||
|
|
||||
|
IntegrationServiceAttribute |
||||
|
.IsDefinedOrInherited<MyIntegrationService2>() |
||||
|
.ShouldBeTrue(); |
||||
|
|
||||
|
// False cases
|
||||
|
|
||||
|
IntegrationServiceAttribute |
||||
|
.IsDefinedOrInherited<IMyIntegrationService2>() |
||||
|
.ShouldBeFalse(); |
||||
|
|
||||
|
IntegrationServiceAttribute |
||||
|
.IsDefinedOrInherited<MyApplicationService>() |
||||
|
.ShouldBeFalse(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
[IntegrationService] |
||||
|
private interface IMyIntegrationService1 { } |
||||
|
private class MyIntegrationService1 : IMyIntegrationService1 { } |
||||
|
|
||||
|
private interface IMyIntegrationService2 { } |
||||
|
[IntegrationService] |
||||
|
private class MyIntegrationService2 : IMyIntegrationService2 { } |
||||
|
|
||||
|
private interface IMyApplicationService { } |
||||
|
private class MyApplicationService : IMyApplicationService { } |
||||
|
} |
||||
|
|
||||
Loading…
Reference in new issue