Skip to content

Commit

Permalink
failing test fix try
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Komisarchik committed Jul 31, 2020
1 parent 7b7585d commit b60795c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/Serilog.Tests/Context/LogContextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,15 @@ public async Task ContextPropertiesCrossAsyncCalls()
{
var pre = Thread.CurrentThread.ManagedThreadId;
await Task.Delay(1000);
await Task.Yield();
var post = Thread.CurrentThread.ManagedThreadId;
log.Write(Some.InformationEvent());
Assert.Equal(1, lastEvent.Properties["A"].LiteralValue());
Assert.False(Thread.CurrentThread.IsThreadPoolThread);
Assert.True(Thread.CurrentThread.IsBackground);
Assert.NotEqual(pre, post);
}
},
Expand Down Expand Up @@ -404,6 +406,6 @@ public bool IsCallable()

class ForceNewThreadSyncContext : SynchronizationContext
{
public override void Post(SendOrPostCallback d, object state) => new Thread(x => d(x)).Start(state);
public override void Post(SendOrPostCallback d, object state) => new Thread(x => d(x)) { IsBackground = true }.Start(state);
}
}

0 comments on commit b60795c

Please sign in to comment.