mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-18 23:28:14 +08:00
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:
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user