Skip to content

Commit

Permalink
feat: Un-ignore test 19.07 (#579)
Browse files Browse the repository at this point in the history
Fixes #203
  • Loading branch information
BenjaminMichaelis authored Nov 5, 2023
1 parent 2c804b9 commit 0adf994
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
34 changes: 17 additions & 17 deletions src/Chapter19.Tests/Listing19.07.Tests.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@

namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_07.Tests;
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.
";
string expected =
@"Sleeping for 2000 ms
Throwing exception.
Event handler starting
Sleeping for 4000 ms
Awake
Finally block running.";

IntelliTect.TestTools.Console.ConsoleAssert.Expect(expected,
() =>
{
Program.Main();
});
string output = IntelliTect.TestTools.Console.ConsoleAssert.Execute(string.Empty,
Program.Main).TrimEnd();

// Assert that all expected lines are present.
Assert.IsTrue(expected.Split(Environment.NewLine).All(output.Contains));

// Assert that the thread ID (first number in each line) is not the same for all lines.
Assert.AreEqual(2, output.Split(Environment.NewLine).Select(
line => line.Split(':')[0]).Distinct().Count());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 0adf994

Please sign in to comment.