Browse Source
Merge pull request #20023 from abpframework/GetDefaultServices
`GetDefaultServices` without case sensitive.
pull/20092/head
Engincan VESKE
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
21 additions and
1 deletions
-
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs
-
framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/AutoRegistrationHelper_Tests.cs
|
|
|
@ -60,7 +60,7 @@ public class ExposeServicesAttribute : Attribute, IExposedServiceTypesProvider |
|
|
|
interfaceName = interfaceName.Right(interfaceName.Length - 1); |
|
|
|
} |
|
|
|
|
|
|
|
if (type.Name.EndsWith(interfaceName)) |
|
|
|
if (type.Name.EndsWith(interfaceName, StringComparison.OrdinalIgnoreCase)) |
|
|
|
{ |
|
|
|
serviceTypes.Add(interfaceType); |
|
|
|
} |
|
|
|
|
|
|
|
@ -20,6 +20,22 @@ public class AutoRegistrationHelper_Tests |
|
|
|
exposedServices.ShouldContain(typeof(IDerivedService)); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Should_Get_Conventional_Exposed_Types_By_Default_Case_Insensitive() |
|
|
|
{ |
|
|
|
//Act
|
|
|
|
|
|
|
|
var exposedServices = ExposedServiceExplorer.GetExposedServices(typeof(defaultderivedservice)); |
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
exposedServices.Count.ShouldBe(3); |
|
|
|
exposedServices.ShouldContain(typeof(defaultderivedservice)); |
|
|
|
exposedServices.ShouldContain(typeof(IService)); |
|
|
|
exposedServices.ShouldContain(typeof(IDerivedService)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Should_Get_Custom_Exposed_Types_If_Available() |
|
|
|
{ |
|
|
|
@ -52,6 +68,10 @@ public class AutoRegistrationHelper_Tests |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
public class defaultderivedservice : IDerivedService |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
public interface IService |
|
|
|
{ |
|
|
|
} |
|
|
|
|