-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6bc9c46
commit fb60a05
Showing
11 changed files
with
210 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
test/IdentityServer.IntegrationTests/Extensibility/CustomLicenseServiceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Duende.IdentityServer.Licensing.v2; | ||
using IntegrationTests.Common; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Xunit; | ||
|
||
namespace IntegrationTests.Extensibility; | ||
|
||
public class CustomLicenseServiceTests | ||
{ | ||
[Fact] | ||
public void customization_of_ILicenseAccessor_is_not_allowed() | ||
{ | ||
var mockPipeline = new IdentityServerPipeline(); | ||
|
||
mockPipeline.OnPostConfigureServices += svcs => | ||
{ | ||
svcs.AddTransient<ILicenseAccessor, CustomLicenseAccessor>(); | ||
}; | ||
|
||
Assert.Throws<InvalidOperationException>(() => mockPipeline.Initialize()); | ||
} | ||
|
||
[Fact] | ||
public void customization_of_IProtocolRequestCounter_is_not_allowed() | ||
{ | ||
var mockPipeline = new IdentityServerPipeline(); | ||
|
||
mockPipeline.OnPostConfigureServices += svcs => | ||
{ | ||
svcs.AddTransient<IProtocolRequestCounter, CustomProtocolRequestCounter>(); | ||
}; | ||
|
||
Assert.Throws<InvalidOperationException>(() => mockPipeline.Initialize()); | ||
} | ||
|
||
[Fact] | ||
public void customization_of_IFeatureManager_is_not_allowed() | ||
{ | ||
var mockPipeline = new IdentityServerPipeline(); | ||
|
||
mockPipeline.OnPostConfigureServices += svcs => | ||
{ | ||
svcs.AddTransient<IFeatureManager, CustomFeatureManager>(); | ||
}; | ||
|
||
Assert.Throws<InvalidOperationException>(() => mockPipeline.Initialize()); | ||
} | ||
} | ||
|
||
|
||
internal class CustomLicenseAccessor : ILicenseAccessor | ||
{ | ||
public License Current { get; } | ||
} | ||
|
||
internal class CustomProtocolRequestCounter : IProtocolRequestCounter | ||
{ | ||
public uint RequestCount { get; } | ||
|
||
public void Increment() | ||
{ | ||
} | ||
} | ||
|
||
internal class CustomFeatureManager : IFeatureManager | ||
{ | ||
public IEnumerable<LicenseFeature> UsedFeatures() => []; | ||
|
||
public void UseFeature(LicenseFeature feature) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.