From 9930d4aeba1907f1af827e3197f4ac5edd82a399 Mon Sep 17 00:00:00 2001 From: Emma Spence Date: Thu, 8 Sep 2022 11:08:06 -0700 Subject: [PATCH 1/2] Added chapters 22 and 23's missing unit tests --- src/Chapter22.Tests/Listing22.09.Tests.cs | 17 +++++++++++++++++ src/Chapter22.Tests/Listing22.10.Tests.cs | 23 +++++++++++++++++++++++ src/Chapter22.Tests/Listing22.11.Tests.cs | 18 ++++++++++++++++++ src/Chapter22.Tests/Listing22.12.Tests.cs | 18 ++++++++++++++++++ src/Chapter23.Tests/Listing23.17.Tests.cs | 17 +++++++++++++++++ src/Chapter23.Tests/Listing23.18.Tests.cs | 17 +++++++++++++++++ src/Chapter23.Tests/Listing23.19.Tests.cs | 17 +++++++++++++++++ 7 files changed, 127 insertions(+) create mode 100644 src/Chapter22.Tests/Listing22.09.Tests.cs create mode 100644 src/Chapter22.Tests/Listing22.10.Tests.cs create mode 100644 src/Chapter22.Tests/Listing22.11.Tests.cs create mode 100644 src/Chapter22.Tests/Listing22.12.Tests.cs create mode 100644 src/Chapter23.Tests/Listing23.17.Tests.cs create mode 100644 src/Chapter23.Tests/Listing23.18.Tests.cs create mode 100644 src/Chapter23.Tests/Listing23.19.Tests.cs diff --git a/src/Chapter22.Tests/Listing22.09.Tests.cs b/src/Chapter22.Tests/Listing22.09.Tests.cs new file mode 100644 index 000000000..cd8f91f68 --- /dev/null +++ b/src/Chapter22.Tests/Listing22.09.Tests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter22.Listing22_09.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"ENTER to shut down"; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter22.Tests/Listing22.10.Tests.cs b/src/Chapter22.Tests/Listing22.10.Tests.cs new file mode 100644 index 000000000..322f814a6 --- /dev/null +++ b/src/Chapter22.Tests/Listing22.10.Tests.cs @@ -0,0 +1,23 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter22.Listing22_10.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"Application started.... +Starting task.... +DoWork() started.... + Waiting while thread executes... +DoWork() ending.... +Thread completed +Application shutting down...."; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter22.Tests/Listing22.11.Tests.cs b/src/Chapter22.Tests/Listing22.11.Tests.cs new file mode 100644 index 000000000..6a1263c8e --- /dev/null +++ b/src/Chapter22.Tests/Listing22.11.Tests.cs @@ -0,0 +1,18 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter22.Listing22_11.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + string expected = $@"Decrement Count = {-32767.01134} +Main Count = {32767.01134}"; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter22.Tests/Listing22.12.Tests.cs b/src/Chapter22.Tests/Listing22.12.Tests.cs new file mode 100644 index 000000000..09bae8078 --- /dev/null +++ b/src/Chapter22.Tests/Listing22.12.Tests.cs @@ -0,0 +1,18 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter22.Listing22_12.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + string expected = $@"Decrement Count = -32767 +Main Count = {32767.01134}"; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter23.Tests/Listing23.17.Tests.cs b/src/Chapter23.Tests/Listing23.17.Tests.cs new file mode 100644 index 000000000..3cda4f5f8 --- /dev/null +++ b/src/Chapter23.Tests/Listing23.17.Tests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter23.Listing23_17.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"S5280ft = Smile "; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter23.Tests/Listing23.18.Tests.cs b/src/Chapter23.Tests/Listing23.18.Tests.cs new file mode 100644 index 000000000..972f88b76 --- /dev/null +++ b/src/Chapter23.Tests/Listing23.18.Tests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter23.Listing23_18.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"S5280ft = Smile "; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter23.Tests/Listing23.19.Tests.cs b/src/Chapter23.Tests/Listing23.19.Tests.cs new file mode 100644 index 000000000..194567623 --- /dev/null +++ b/src/Chapter23.Tests/Listing23.19.Tests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter23.Listing23_19.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = "30° 18\' 0\""; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file From 80fadffe40475204e6d978bcd4e3ae1523d169a6 Mon Sep 17 00:00:00 2001 From: Emma Spence Date: Thu, 8 Sep 2022 12:22:51 -0700 Subject: [PATCH 2/2] Fixing 22.12 test with wildcard --- src/Chapter22.Tests/Listing22.12.Tests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Chapter22.Tests/Listing22.12.Tests.cs b/src/Chapter22.Tests/Listing22.12.Tests.cs index 09bae8078..316e5aca4 100644 --- a/src/Chapter22.Tests/Listing22.12.Tests.cs +++ b/src/Chapter22.Tests/Listing22.12.Tests.cs @@ -8,10 +8,10 @@ public class ProgramTests [TestMethod] public void MainTest() { - string expected = $@"Decrement Count = -32767 -Main Count = {32767.01134}"; + const string expected = @"Decrement Count = * +Main Count = *"; - IntelliTect.TestTools.Console.ConsoleAssert.Expect( + IntelliTect.TestTools.Console.ConsoleAssert.ExpectLike( expected, Program.Main); } }