mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 06:48:16 +08:00
removed some code we dont need as not expecting any errors so should just throw an exception to the global handler
This commit is contained in:
@ -51,7 +51,7 @@ namespace Ocelot.UnitTests.LoadBalancer
|
||||
{
|
||||
var hostAndPort = await _leastConnection.Lease();
|
||||
await Task.Delay(_random.Next(1, 100));
|
||||
var response = _leastConnection.Release(hostAndPort.Data);
|
||||
_leastConnection.Release(hostAndPort.Data);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -114,7 +114,7 @@ namespace Ocelot.UnitTests.LoadBalancer
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Response Release(HostAndPort hostAndPort)
|
||||
public void Release(HostAndPort hostAndPort)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -127,7 +127,7 @@ namespace Ocelot.UnitTests.LoadBalancer
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Response Release(HostAndPort hostAndPort)
|
||||
public void Release(HostAndPort hostAndPort)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -170,6 +170,15 @@ namespace Ocelot.UnitTests.LoadBalancer
|
||||
.Verify(x => x.Add("OcelotMiddlewareErrors", _getLoadBalancerHouseError.Errors), Times.Once);
|
||||
}
|
||||
|
||||
private void ThenAnErrorSayingReleaseFailedIsSetOnThePipeline()
|
||||
{
|
||||
_scopedRepository
|
||||
.Verify(x => x.Add("OcelotMiddlewareError", true), Times.Once);
|
||||
|
||||
_scopedRepository
|
||||
.Verify(x => x.Add("OcelotMiddlewareErrors", It.IsAny<List<Error>>()), Times.Once);
|
||||
}
|
||||
|
||||
private void ThenAnErrorStatingHostAndPortCouldNotBeFoundIsSetOnPipeline()
|
||||
{
|
||||
_scopedRepository
|
||||
|
@ -62,19 +62,11 @@ namespace Ocelot.UnitTests.Responder
|
||||
{
|
||||
this.Given(x => x.GivenTheHttpResponseMessageIs(new HttpResponseMessage()))
|
||||
.And(x => x.GivenThereAreNoPipelineErrors())
|
||||
.And(x => x.GivenTheResponderReturns())
|
||||
.When(x => x.WhenICallTheMiddleware())
|
||||
.Then(x => x.ThenThereAreNoErrors())
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenTheResponderReturns()
|
||||
{
|
||||
_responder
|
||||
.Setup(x => x.SetResponseOnHttpContext(It.IsAny<HttpContext>(), It.IsAny<HttpResponseMessage>()))
|
||||
.ReturnsAsync(new OkResponse());
|
||||
}
|
||||
|
||||
private void GivenThereAreNoPipelineErrors()
|
||||
{
|
||||
_scopedRepository
|
||||
|
Reference in New Issue
Block a user