Feature/merge configuration files (#316)

* #296 renamed configuration.json to ocelot.json in preparation

* removed things we dont need for tests

* another file we dont need

* removed some async we dont need

* refactoring to consolidate configuration code

* removed another pointless abstraction

* #296 started writing merge code

* #296 coming up with ideas for this config merging

* #296 still hacking this idea around

* #296 will now do a crappy merge on the configuration

* #296 change so tests pass on windows
This commit is contained in:
Tom Pallister
2018-04-17 22:06:41 +01:00
committed by GitHub
parent 3607c0867e
commit aa55fe34cb
84 changed files with 883 additions and 1050 deletions

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Ocelot.Configuration;
using Ocelot.Configuration.Builder;
using Ocelot.Configuration.Repository;
@ -14,14 +12,14 @@ namespace Ocelot.UnitTests.Configuration
{
public class InMemoryConfigurationRepositoryTests
{
private readonly InMemoryOcelotConfigurationRepository _repo;
private IOcelotConfiguration _config;
private readonly InMemoryInternalConfigurationRepository _repo;
private IInternalConfiguration _config;
private Response _result;
private Response<IOcelotConfiguration> _getResult;
private Response<IInternalConfiguration> _getResult;
public InMemoryConfigurationRepositoryTests()
{
_repo = new InMemoryOcelotConfigurationRepository();
_repo = new InMemoryInternalConfigurationRepository();
}
[Fact]
@ -49,7 +47,7 @@ namespace Ocelot.UnitTests.Configuration
private void WhenIGetTheConfiguration()
{
_getResult = _repo.Get().Result;
_getResult = _repo.Get();
}
private void GivenThereIsASavedConfiguration()
@ -58,14 +56,14 @@ namespace Ocelot.UnitTests.Configuration
WhenIAddOrReplaceTheConfig();
}
private void GivenTheConfigurationIs(IOcelotConfiguration config)
private void GivenTheConfigurationIs(IInternalConfiguration config)
{
_config = config;
}
private void WhenIAddOrReplaceTheConfig()
{
_result = _repo.AddOrReplace(_config).Result;
_result = _repo.AddOrReplace(_config);
}
private void ThenNoErrorsAreReturned()
@ -73,7 +71,7 @@ namespace Ocelot.UnitTests.Configuration
_result.IsError.ShouldBeFalse();
}
class FakeConfig : IOcelotConfiguration
class FakeConfig : IInternalConfiguration
{
private readonly string _downstreamTemplatePath;