Skip to content

Commit

Permalink
#262 fixed warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
TomPallister committed Apr 20, 2018
1 parent e99413f commit 43408ba
Showing 1 changed file with 2 additions and 53 deletions.
55 changes: 2 additions & 53 deletions test/Ocelot.AcceptanceTests/ServiceDiscoveryTests.cs
Expand Up @@ -13,9 +13,6 @@ namespace Ocelot.AcceptanceTests
using Shouldly;
using TestStack.BDDfy;
using Xunit;
using System.Diagnostics;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using Pivotal.Discovery.Client;

Expand Down Expand Up @@ -84,21 +81,10 @@ public void should_use_eureka_service_discovery_and_make_request()
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
.And(_ => _steps.ThenTheResponseBodyShouldBe(nameof(EurekaStartup)))
.And(_ => _steps.ThenTheResponseBodyShouldBe(nameof(ServiceDiscoveryTests)))
.BDDfy();
}

private void Sleep()
{
var stopWatch = Stopwatch.StartNew();
while (stopWatch.ElapsedMilliseconds < 5000)
{

}

stopWatch.Stop();
}

[Fact]
public void should_use_consul_service_discovery_and_load_balance_request()
{
Expand Down Expand Up @@ -594,15 +580,14 @@ private void GivenEurekaProductServiceOneIsRunning(string url, int statusCode)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseUrls(url)
//.UseStartup<EurekaStartup>()
.Configure(app =>
{
app.Run(async context =>
{
try
{
context.Response.StatusCode = 200;
await context.Response.WriteAsync(nameof(EurekaStartup));
await context.Response.WriteAsync(nameof(ServiceDiscoveryTests));
}
catch (Exception exception)
{
Expand Down Expand Up @@ -762,40 +747,4 @@ public class EurekaApplications
{
public Applications applications { get; set; }
}

public class EurekaStartup
{
public IConfiguration Configuration { get; }
public EurekaStartup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.product.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();

Configuration = builder.Build();
}

public void ConfigureServices(IServiceCollection services)
{
services.AddDiscoveryClient(Configuration);
}

public void Configure(IApplicationBuilder app)
{
app.UseDiscoveryClient();
app.Run(async context =>
{
try
{
context.Response.StatusCode = 200;
await context.Response.WriteAsync(nameof(EurekaStartup));
}
catch (Exception exception)
{
await context.Response.WriteAsync(exception.StackTrace);
}
});
}
}
}

0 comments on commit 43408ba

Please sign in to comment.