Skip to content

Commit

Permalink
Make sure the issue isn't related to PortableTimer and Synchronizatio…
Browse files Browse the repository at this point in the history
…nContext.
  • Loading branch information
nblumhardt committed Nov 20, 2015
1 parent 2b2c93e commit 8ae5284
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Serilog.Events;
using Serilog.Sinks.PeriodicBatching;
Expand Down Expand Up @@ -81,9 +82,15 @@ public void WhenAnEventIsEnqueuedItIsWrittenToABatch_OnFlush()
public void WhenAnEventIsEnqueuedItIsWrittenToABatch_OnTimer()
{
var pbs = new InMemoryPeriodicBatchingSink(2, TinyWait, TimeSpan.Zero);
var evt = Some.InformationEvent();
pbs.Emit(evt);
Task.Run(() =>
{
Console.WriteLine("TEST: Writing");
var evt = Some.InformationEvent();
pbs.Emit(evt);
});
Console.WriteLine("TEST: Sleeping");
Thread.Sleep(TimeSpan.FromSeconds(1));
Console.WriteLine("TEST: Stopping");
pbs.Stop();
Assert.Equal(1, pbs.Batches.Count);
Assert.False(pbs.WasCalledAfterDisposal);
Expand Down

0 comments on commit 8ae5284

Please sign in to comment.