Browse Source

Merge pull request #20023 from abpframework/GetDefaultServices

`GetDefaultServices` without case sensitive.
pull/20092/head
Engincan VESKE 2 years ago
committed by GitHub
parent
commit
012c450aba
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.cs
  2. 20
      framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/AutoRegistrationHelper_Tests.cs

2
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposeServicesAttribute.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
framework/test/Volo.Abp.Core.Tests/Volo/Abp/DependencyInjection/AutoRegistrationHelper_Tests.cs

@ -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
{
}

Loading…
Cancel
Save