mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 01:58:15 +08:00
Added tests for identity server reference tokens, general refactoring and come config validation
This commit is contained in:
@ -37,6 +37,53 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void configuration_is_valid_with_valid_authentication_provider()
|
||||
{
|
||||
this.Given(x => x.GivenAConfiguration(new YamlConfiguration()
|
||||
{
|
||||
ReRoutes = new List<YamlReRoute>
|
||||
{
|
||||
new YamlReRoute
|
||||
{
|
||||
DownstreamTemplate = "http://www.bbc.co.uk",
|
||||
UpstreamTemplate = "http://asdf.com",
|
||||
AuthenticationOptions = new YamlAuthenticationOptions
|
||||
{
|
||||
Provider = "IdentityServer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
.When(x => x.WhenIValidateTheConfiguration())
|
||||
.Then(x => x.ThenTheResultIsValid())
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void configuration_is_invalid_with_invalid_authentication_provider()
|
||||
{
|
||||
this.Given(x => x.GivenAConfiguration(new YamlConfiguration()
|
||||
{
|
||||
ReRoutes = new List<YamlReRoute>
|
||||
{
|
||||
new YamlReRoute
|
||||
{
|
||||
DownstreamTemplate = "http://www.bbc.co.uk",
|
||||
UpstreamTemplate = "http://asdf.com",
|
||||
AuthenticationOptions = new YamlAuthenticationOptions
|
||||
{
|
||||
Provider = "BootyBootyBottyRockinEverywhere"
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
.When(x => x.WhenIValidateTheConfiguration())
|
||||
.Then(x => x.ThenTheResultIsNotValid())
|
||||
.And(x => x.ThenTheErrorIs<UnsupportedAuthenticationProviderError>())
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void configuration_is_not_valid_with_duplicate_reroutes()
|
||||
{
|
||||
|
Reference in New Issue
Block a user