#296 started writing merge code

This commit is contained in:
Tom Pallister
2018-04-14 07:02:17 +01:00
parent fe9bca7b77
commit 7ca828836a
4 changed files with 96 additions and 40 deletions

View File

@ -6,6 +6,11 @@ using Xunit;
namespace Ocelot.UnitTests.DependencyInjection
{
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using Ocelot.Configuration.File;
public class ConfigurationBuilderExtensionsTests
{
private IConfigurationRoot _configuration;
@ -20,6 +25,61 @@ namespace Ocelot.UnitTests.DependencyInjection
.BDDfy();
}
[Fact]
public void should_merge_files()
{
var globalConfig = new FileConfiguration
{
GlobalConfiguration = new FileGlobalConfiguration
{
BaseUrl = "BaseUrl",
RateLimitOptions = new FileRateLimitOptions
{
HttpStatusCode = 500,
ClientIdHeader = "ClientIdHeader",
DisableRateLimitHeaders = true,
QuotaExceededMessage = "QuotaExceededMessage",
RateLimitCounterPrefix = "RateLimitCounterPrefix"
}
}
};
var reRoute = new FileConfiguration
{
ReRoutes = new List<FileReRoute>
{
new FileReRoute
{
DownstreamScheme = "DownstreamScheme",
Key = "Key",
UpstreamHost = "UpstreamHost",
UpstreamHttpMethod = new List<string>
{
"UpstreamHttpMethod"
},
DownstreamHostAndPorts = new List<FileHostAndPort>
{
new FileHostAndPort
{
Host = "Host",
Port = 80
}
}
}
}
};
var globalJson = JsonConvert.SerializeObject(globalConfig);
//File.WriteAllText("ocelot.global.json", globalJson);
var reRouteJson = JsonConvert.SerializeObject(reRoute);
//File.WriteAllText("ocelot.reRoute.json", reRouteJson);
IConfigurationBuilder builder = new ConfigurationBuilder();
//builder.AddOcelot();
}
private void GivenTheBaseUrl(string baseUrl)
{
#pragma warning disable CS0618