Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public async Task Test1()
- {
- var exception = await RunAvaloniaTest(async () =>
- {
- var clipboard = Application.Current.Clipboard;
- await clipboard.SetTextAsync("Test").ConfigureAwait(true);
- var text = await clipboard.GetTextAsync().ConfigureAwait(true);
- Assert.Equal("", "123");
- int y = 2;
- });
- if(exception != null)
- {
- throw exception;
- }
- }
- public static async Task<Exception> RunAvaloniaTest(Action testCode)
- {
- var tcs = new TaskCompletionSource<Exception>();
- BuildAvaloniaApp().Start(async (app, args) =>
- {
- try
- {
- testCode();
- }
- catch (Exception e)
- {
- tcs.SetResult(e);
- return;
- }
- tcs.SetResult(null);
- }, null);
- return await tcs.Task;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement