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

@ -8,32 +8,30 @@ using Ocelot.Responses;
using TestStack.BDDfy;
using Xunit;
using Shouldly;
using Ocelot.Configuration.Provider;
using Microsoft.Extensions.DependencyInjection;
using Ocelot.Raft;
using Rafty.Concensus;
using Newtonsoft.Json;
using Rafty.FiniteStateMachine;
using Ocelot.Configuration;
namespace Ocelot.UnitTests.Controllers
{
using Ocelot.Configuration.Repository;
public class FileConfigurationControllerTests
{
private FileConfigurationController _controller;
private Mock<IFileConfigurationProvider> _configGetter;
private Mock<IFileConfigurationSetter> _configSetter;
private readonly FileConfigurationController _controller;
private readonly Mock<IFileConfigurationRepository> _repo;
private readonly Mock<IFileConfigurationSetter> _setter;
private IActionResult _result;
private FileConfiguration _fileConfiguration;
private Mock<IServiceProvider> _provider;
private readonly Mock<IServiceProvider> _provider;
private Mock<INode> _node;
public FileConfigurationControllerTests()
{
_provider = new Mock<IServiceProvider>();
_configGetter = new Mock<IFileConfigurationProvider>();
_configSetter = new Mock<IFileConfigurationSetter>();
_controller = new FileConfigurationController(_configGetter.Object, _configSetter.Object, _provider.Object);
_repo = new Mock<IFileConfigurationRepository>();
_setter = new Mock<IFileConfigurationSetter>();
_controller = new FileConfigurationController(_repo.Object, _setter.Object, _provider.Object);
}
[Fact]
@ -140,14 +138,14 @@ namespace Ocelot.UnitTests.Controllers
private void GivenTheConfigSetterReturns(Response response)
{
_configSetter
_setter
.Setup(x => x.Set(It.IsAny<FileConfiguration>()))
.ReturnsAsync(response);
}
private void ThenTheConfigrationSetterIsCalledCorrectly()
{
_configSetter
_setter
.Verify(x => x.Set(_fileConfiguration), Times.Once);
}
@ -168,7 +166,7 @@ namespace Ocelot.UnitTests.Controllers
private void GivenTheGetConfigurationReturns(Ocelot.Responses.Response<FileConfiguration> fileConfiguration)
{
_configGetter
_repo
.Setup(x => x.Get())
.ReturnsAsync(fileConfiguration);
}
@ -180,7 +178,7 @@ namespace Ocelot.UnitTests.Controllers
private void TheTheGetFileConfigurationIsCalledCorrectly()
{
_configGetter
_repo
.Verify(x => x.Get(), Times.Once);
}