From 730b2183d5c9ea0c5902a5045adfe777d824a6ae Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Sat, 4 Nov 2023 09:57:15 +0100 Subject: [PATCH] Un-ignore test --- src/Chapter19.Tests/Listing19.07.Tests.cs | 26 +++++++------------ ...19.07.RegisteringForUnhandledExceptions.cs | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/Chapter19.Tests/Listing19.07.Tests.cs b/src/Chapter19.Tests/Listing19.07.Tests.cs index 0d2e9dff5..403133347 100644 --- a/src/Chapter19.Tests/Listing19.07.Tests.cs +++ b/src/Chapter19.Tests/Listing19.07.Tests.cs @@ -4,24 +4,18 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_07.Tests; [TestClass] public class ProgramTests { - [TestMethod][Ignore] + [TestMethod] public void ValueTaskAsyncReturnTest() { - string expected = @"3:0047:Throwing exception. -3:0052:Unhandled exception handler starting. -3:0055:Sleeping for 4000 ms -1:0058:Sleeping for 2000 ms -1:2059:Awake -1:2060:Finally block running. -3:4059:Awake -Unhandled Exception: System.Exception: Exception of type 'System.Exception' was thrown. -"; - - IntelliTect.TestTools.Console.ConsoleAssert.Expect(expected, - () => - { - Program.Main(); - }); + string expected = +@"*:*:Sleeping for 2000 ms +*:*:Throwing exception. +*:*:Event handler starting +*:*:Sleeping for 4000 ms +*:*:Awake +*:*:Finally block running."; + IntelliTect.TestTools.Console.ConsoleAssert.ExpectLike(expected, + Program.Main); } } \ No newline at end of file diff --git a/src/Chapter19/Listing19.07.RegisteringForUnhandledExceptions.cs b/src/Chapter19/Listing19.07.RegisteringForUnhandledExceptions.cs index 93103c526..5cfab23d3 100644 --- a/src/Chapter19/Listing19.07.RegisteringForUnhandledExceptions.cs +++ b/src/Chapter19/Listing19.07.RegisteringForUnhandledExceptions.cs @@ -50,7 +50,7 @@ static void Delay(int i) static void Message(string text) { Console.WriteLine("{0}:{1:0000}:{2}", - Thread.CurrentThread.ManagedThreadId, + Environment.CurrentManagedThreadId, Clock.ElapsedMilliseconds, text); } }