diff --git a/src/Chapter04.Tests/Listing04.28.Tests.cs b/src/Chapter04.Tests/Listing04.28.Tests.cs index 69ff45106..3296a0bfd 100644 --- a/src/Chapter04.Tests/Listing04.28.Tests.cs +++ b/src/Chapter04.Tests/Listing04.28.Tests.cs @@ -1,15 +1,15 @@ +using AddisonWesley.Michaelis.EssentialCSharp.Shared.Tests; namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter04.Listing04_28.Tests; [TestClass] public class ProgramTests { + private static readonly string[] ExpectedErrorIds = new string[] { "CS0103" }; + [TestMethod] - public void MainTest() + public async Task CompileError_OutOfScope() { - const string expected = @"Enter the number of players (1 or 2):"; - - IntelliTect.TestTools.Console.ConsoleAssert.Expect( - expected, Program.Main); + await CompilerAssert.CompileAsync($"Listing04.28.OutOfScope.cs", ExpectedErrorIds); } } diff --git a/src/Chapter04/Listing04.28.OutOfScope.cs b/src/Chapter04/Listing04.28.OutOfScope.cs index cae91131c..ae436f5f5 100644 --- a/src/Chapter04/Listing04.28.OutOfScope.cs +++ b/src/Chapter04/Listing04.28.OutOfScope.cs @@ -27,12 +27,12 @@ public static void Main(string[] args) { // ... } - #if COMPILE_ERRR //EXCLUDE + #if COMPILEERROR //EXCLUDE #region HIGHLIGHT // ERROR: message is not in scope: Console.WriteLine(message); #endregion HIGHLIGHT - #endif // COMPILE_ERRR //EXCLUDE + #endif // COMPILEERROR //EXCLUDE #endregion INCLUDE } }