Added tests for identity server reference tokens, general refactoring and come config validation

This commit is contained in:
TomPallister
2016-10-16 20:28:23 +01:00
parent 7289cd803b
commit ce84ad4fc2
26 changed files with 565 additions and 150 deletions

View File

@ -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()
{