removed another pointless abstraction

This commit is contained in:
Tom Pallister
2018-04-14 06:32:00 +01:00
parent fe5662f954
commit fe9bca7b77
20 changed files with 138 additions and 364 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);
}