Feature/hacking consul file config (#157)

* moving things around to see if I can get consul to store fileconfiguration rather than ocelotconfiguration

* more refactoring to see if we can get a test for the feature

* acceptance test passing for updating in consul..need to sort object comparison out

* fixed the failing tests
This commit is contained in:
Tom Pallister
2017-11-17 17:58:39 +00:00
committed by GitHub
parent d377482013
commit 68242102d8
22 changed files with 478 additions and 62 deletions

View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Ocelot.DependencyInjection;
using Shouldly;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.DependencyInjection
{
public class ServiceCollectionExtensionTests
{
private Exception _ex;
[Fact]
public void should_set_up_services()
{
this.When(x => WhenISetUpOcelotServices())
.Then(x => ThenAnExceptionIsntThrown())
.BDDfy();
}
private void WhenISetUpOcelotServices()
{
try
{
IWebHostBuilder builder = new WebHostBuilder();
IConfigurationRoot configRoot = new ConfigurationRoot(new List<IConfigurationProvider>());
IServiceCollection services = new ServiceCollection();
services.AddSingleton(builder);
services.AddOcelot(configRoot);
}
catch (Exception e)
{
_ex = e;
}
}
private void ThenAnExceptionIsntThrown()
{
_ex.ShouldBeNull();
}
}
}