mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 00:58:15 +08:00
refactoring acceptance tests..they need some tlc
This commit is contained in:
@ -11,7 +11,6 @@ using Ocelot.ManualTest;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
@ -20,22 +19,19 @@ namespace Ocelot.AcceptanceTests
|
||||
private TestServer _ocelotServer;
|
||||
private HttpClient _ocelotClient;
|
||||
private HttpResponseMessage _response;
|
||||
private readonly string _configurationPath;
|
||||
private IWebHost _servicebuilder;
|
||||
|
||||
// Sadly we need to change this when we update the netcoreapp version to make the test update the config correctly
|
||||
private double _netCoreAppVersion = 1.4;
|
||||
private readonly Steps _steps;
|
||||
|
||||
public ReturnsErrorTests()
|
||||
{
|
||||
_configurationPath = $"./bin/Debug/netcoreapp{_netCoreAppVersion}/configuration.yaml";
|
||||
_steps = new Steps();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_200_and_foward_claim_as_header()
|
||||
{
|
||||
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:53876"))
|
||||
.And(x => x.GivenThereIsAConfiguration(new YamlConfiguration
|
||||
.And(x => _steps.GivenThereIsAConfiguration(new YamlConfiguration
|
||||
{
|
||||
ReRoutes = new List<YamlReRoute>
|
||||
{
|
||||
@ -74,21 +70,6 @@ namespace Ocelot.AcceptanceTests
|
||||
_ocelotClient = _ocelotServer.CreateClient();
|
||||
}
|
||||
|
||||
private void GivenThereIsAConfiguration(YamlConfiguration yamlConfiguration)
|
||||
{
|
||||
var serializer = new Serializer();
|
||||
|
||||
if (File.Exists(_configurationPath))
|
||||
{
|
||||
File.Delete(_configurationPath);
|
||||
}
|
||||
|
||||
using (TextWriter writer = File.CreateText(_configurationPath))
|
||||
{
|
||||
serializer.Serialize(writer, yamlConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
private void GivenThereIsAServiceRunningOn(string url)
|
||||
{
|
||||
_servicebuilder = new WebHostBuilder()
|
||||
|
Reference in New Issue
Block a user