mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 04:18:16 +08:00
Feature/use any id server for admin area (#232)
* initial commits around using any id servers * add your own id server for admin area * lots of refactoring, now instead of injecting IWebHostBuilder we just set the Ocelot base url as a configuration extension method..this means people can pass it in on the command line aswell as hardcode which is OK I guess, also can now use your own IdentityServer to authenticate admin area * updated docs for #231 * some tests that hopefully bump up coverage
This commit is contained in:
@ -0,0 +1,41 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
namespace Ocelot.UnitTests.DependencyInjection
|
||||
{
|
||||
public class ConfigurationBuilderExtensionsTests
|
||||
{
|
||||
private IConfigurationRoot _configuration;
|
||||
private string _result;
|
||||
|
||||
[Fact]
|
||||
public void should_add_base_url_to_config()
|
||||
{
|
||||
this.Given(x => GivenTheBaseUrl("test"))
|
||||
.When(x => WhenIGet("BaseUrl"))
|
||||
.Then(x => ThenTheResultIs("test"))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenTheBaseUrl(string baseUrl)
|
||||
{
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddOcelotBaseUrl(baseUrl);
|
||||
|
||||
_configuration = builder.Build();
|
||||
}
|
||||
|
||||
private void WhenIGet(string key)
|
||||
{
|
||||
_result = _configuration.GetValue("BaseUrl", "");
|
||||
}
|
||||
|
||||
private void ThenTheResultIs(string expected)
|
||||
{
|
||||
_result.ShouldBe(expected);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user