-
Notifications
You must be signed in to change notification settings - Fork 0
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
297d6e3
commit af59463
Showing
3 changed files
with
98 additions
and
27 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
src/IIIFAuth2/IIIFAuth2.API.Tests/Models/Domain/RoleProviderConfigurationTests.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,61 @@ | ||
using IIIFAuth2.API.Models.Domain; | ||
|
||
namespace IIIFAuth2.API.Tests.Models.Domain; | ||
|
||
public class RoleProviderConfigurationTests | ||
{ | ||
[Fact] | ||
public void GetConfiguration_ReturnsDefault_IfNoHostSpecificConfig() | ||
{ | ||
// Arrange | ||
var defaultConfig = new ClickthroughConfiguration { GestureTitle = "test" }; | ||
var roleProviderConfig = new RoleProviderConfiguration | ||
{ | ||
{ RoleProviderConfiguration.DefaultKey, defaultConfig } | ||
}; | ||
|
||
// Act | ||
var actual = roleProviderConfig.GetConfiguration("localhost"); | ||
|
||
// Assert | ||
actual.Should().Be(defaultConfig); | ||
} | ||
|
||
[Fact] | ||
public void GetConfiguration_ReturnsDefault_IfHostSpecificConfigNotFound() | ||
{ | ||
// Arrange | ||
var defaultConfig = new ClickthroughConfiguration { GestureTitle = "test" }; | ||
var hostConfig = new ClickthroughConfiguration { GestureTitle = "anotherTest" }; | ||
var roleProviderConfig = new RoleProviderConfiguration | ||
{ | ||
{ RoleProviderConfiguration.DefaultKey, defaultConfig }, | ||
{ "test.example", hostConfig } | ||
}; | ||
|
||
// Act | ||
var actual = roleProviderConfig.GetConfiguration("localhost"); | ||
|
||
// Assert | ||
actual.Should().Be(defaultConfig); | ||
} | ||
|
||
[Fact] | ||
public void GetConfiguration_ReturnsHostSpecific_IfFound() | ||
{ | ||
// Arrange | ||
var defaultConfig = new ClickthroughConfiguration { GestureTitle = "test" }; | ||
var hostConfig = new ClickthroughConfiguration { GestureTitle = "anotherTest" }; | ||
var roleProviderConfig = new RoleProviderConfiguration | ||
{ | ||
{ RoleProviderConfiguration.DefaultKey, defaultConfig }, | ||
{ "test.example", hostConfig } | ||
}; | ||
|
||
// Act | ||
var actual = roleProviderConfig.GetConfiguration("test.example"); | ||
|
||
// Assert | ||
actual.Should().Be(hostConfig); | ||
} | ||
} |
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