Add tests for #1084

This commit is contained in:
Angelo Breuer
2021-01-13 16:24:24 +01:00
parent 4bbc2fc22d
commit 3ca84f8381

View File

@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Terminal.Gui;
using Xunit;
@@ -220,5 +222,30 @@ namespace Terminal.Gui {
Application.Shutdown ();
Assert.Equal (3, count);
}
[Fact]
public void Shutdown_Allows_Async ()
{
static async Task TaskWithAsyncContinuation ()
{
await Task.Yield ();
await Task.Yield ();
}
Init ();
Application.Shutdown ();
var task = TaskWithAsyncContinuation ();
Thread.Sleep (20);
Assert.True (task.IsCompletedSuccessfully);
}
[Fact]
public void Shutdown_Resets_SyncContext ()
{
Init ();
Application.Shutdown ();
Assert.Null (SynchronizationContext.Current);
}
}
}