changed to json configuration to get rid of yaml imports

This commit is contained in:
TomPallister
2016-11-02 21:50:53 +00:00
parent 190e394011
commit f4acb4f041
33 changed files with 386 additions and 356 deletions

View File

@ -5,7 +5,7 @@ using System.Net;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Ocelot.Configuration.Yaml;
using Ocelot.Configuration.File;
using TestStack.BDDfy;
using Xunit;
@ -24,7 +24,7 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_response_404_when_no_configuration_at_all()
{
this.Given(x => _steps.GivenThereIsAConfiguration(new YamlConfiguration()))
this.Given(x => _steps.GivenThereIsAConfiguration(new FileConfiguration()))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.NotFound))
@ -34,11 +34,11 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_response_200_with_simple_url()
{
var yamlConfiguration = new YamlConfiguration
var configuration = new FileConfiguration
{
ReRoutes = new List<YamlReRoute>
ReRoutes = new List<FileReRoute>
{
new YamlReRoute
new FileReRoute
{
DownstreamTemplate = "http://localhost:51879/",
UpstreamTemplate = "/",
@ -48,7 +48,7 @@ namespace Ocelot.AcceptanceTests
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51879", 200, "Hello from Laura"))
.And(x => _steps.GivenThereIsAConfiguration(yamlConfiguration))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
@ -59,11 +59,11 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_response_200_with_complex_url()
{
var yamlConfiguration = new YamlConfiguration
var configuration = new FileConfiguration
{
ReRoutes = new List<YamlReRoute>
ReRoutes = new List<FileReRoute>
{
new YamlReRoute
new FileReRoute
{
DownstreamTemplate = "http://localhost:51879/api/products/{productId}",
UpstreamTemplate = "/products/{productId}",
@ -73,7 +73,7 @@ namespace Ocelot.AcceptanceTests
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51879/api/products/1", 200, "Some Product"))
.And(x => _steps.GivenThereIsAConfiguration(yamlConfiguration))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/products/1"))
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
@ -84,11 +84,11 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_response_201_with_simple_url()
{
var yamlConfiguration = new YamlConfiguration
var configuration = new FileConfiguration
{
ReRoutes = new List<YamlReRoute>
ReRoutes = new List<FileReRoute>
{
new YamlReRoute
new FileReRoute
{
DownstreamTemplate = "http://localhost:51879/",
UpstreamTemplate = "/",
@ -98,7 +98,7 @@ namespace Ocelot.AcceptanceTests
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51879", 201, string.Empty))
.And(x => _steps.GivenThereIsAConfiguration(yamlConfiguration))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.And(x => _steps.GivenThePostHasContent("postContent"))
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
@ -109,11 +109,11 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_response_201_with_complex_query_string()
{
var yamlConfiguration = new YamlConfiguration
var configuration = new FileConfiguration
{
ReRoutes = new List<YamlReRoute>
ReRoutes = new List<FileReRoute>
{
new YamlReRoute
new FileReRoute
{
DownstreamTemplate = "http://localhost:51879/newThing",
UpstreamTemplate = "/newThing",
@ -123,7 +123,7 @@ namespace Ocelot.AcceptanceTests
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51879", 200, "Hello from Laura"))
.And(x => _steps.GivenThereIsAConfiguration(yamlConfiguration))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/newThing?DeviceType=IphoneApp&Browser=moonpigIphone&BrowserString=-&CountryCode=123&DeviceName=iPhone 5 (GSM+CDMA)&OperatingSystem=iPhone OS 7.1.2&BrowserVersion=3708AdHoc&ipAddress=-"))
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))