public async Task When_server_signals_exit_then_should_notifiy_client_to_exit() { var exitCalled = new TaskCompletionSource <bool>(); var listener = await CooperativeShutdown.Listen( () => exitCalled.SetResult(true)); await CooperativeShutdown.SignalExit(Process.GetCurrentProcess().Id); (await exitCalled.Task.TimeoutAfter(TimeSpan.FromSeconds(2))).ShouldBeTrue(); listener.Dispose(); }
public async Task When_server_signals_exit_then_should_notify_client_to_exit() { var exitCalled = new TaskCompletionSource <bool>(); var listener = await CooperativeShutdown.Listen( () => exitCalled.SetResult(true), _loggerFactory); await CooperativeShutdown.SignalExit(Process.GetCurrentProcess().Id, _loggerFactory); (await exitCalled.Task).ShouldBeTrue(); listener.Dispose(); }