implemented a send to self pattern for sticky session timeouts rather than a normal timer

This commit is contained in:
Tom Pallister
2018-05-05 13:43:38 +01:00
parent c041d90e38
commit fb3af754ab
10 changed files with 965 additions and 1017 deletions

View File

@ -7,11 +7,11 @@ namespace Ocelot.UnitTests.Infrastructure
{
public class InMemoryBusTests
{
private InMemoryBus<Message> _bus;
private readonly InMemoryBus<object> _bus;
public InMemoryBusTests()
{
_bus = new InMemoryBus<Message>();
_bus = new InMemoryBus<object>();
}
[Fact]
@ -21,26 +21,20 @@ namespace Ocelot.UnitTests.Infrastructure
_bus.Subscribe(x => {
called = true;
});
await _bus.Publish(new Message(), 1);
_bus.Publish(new object(), 1);
await Task.Delay(10);
called.ShouldBeTrue();
}
[Fact]
public async Task should_not_be_publish_yet_as_no_delay_in_caller()
public void should_not_be_publish_yet_as_no_delay_in_caller()
{
var called = false;
_bus.Subscribe(x => {
called = true;
});
await _bus.Publish(new Message(), 1);
_bus.Publish(new object(), 1);
called.ShouldBeFalse();
}
class Message
{
}
}
}