From e968dbf0a683352c4138ae70a04c1c8c835686f9 Mon Sep 17 00:00:00 2001 From: Emma Spence Date: Tue, 23 Aug 2022 14:32:16 -0700 Subject: [PATCH 1/5] Added Unit Tests for Chapter 18 --- src/Chapter18.Tests/Listing18.01.Tests.cs | 33 +++++++++++++++++++++++ src/Chapter18.Tests/Listing18.02.Tests.cs | 17 ++++++++++++ src/Chapter18.Tests/Listing18.06.Tests.cs | 17 ++++++++++++ src/Chapter18.Tests/Listing18.16.Tests.cs | 17 ++++++++++++ src/Chapter18.Tests/Listing18.24.Tests.cs | 19 +++++++++++++ src/Chapter18.Tests/Listing18.26.Tests.cs | 18 +++++++++++++ src/Chapter18.Tests/Listing18.27.Tests.cs | 17 ++++++++++++ src/Chapter18.Tests/Listing18.28.Tests.cs | 17 ++++++++++++ 8 files changed, 155 insertions(+) create mode 100644 src/Chapter18.Tests/Listing18.01.Tests.cs create mode 100644 src/Chapter18.Tests/Listing18.02.Tests.cs create mode 100644 src/Chapter18.Tests/Listing18.06.Tests.cs create mode 100644 src/Chapter18.Tests/Listing18.16.Tests.cs create mode 100644 src/Chapter18.Tests/Listing18.24.Tests.cs create mode 100644 src/Chapter18.Tests/Listing18.26.Tests.cs create mode 100644 src/Chapter18.Tests/Listing18.27.Tests.cs create mode 100644 src/Chapter18.Tests/Listing18.28.Tests.cs diff --git a/src/Chapter18.Tests/Listing18.01.Tests.cs b/src/Chapter18.Tests/Listing18.01.Tests.cs new file mode 100644 index 000000000..592a9dffc --- /dev/null +++ b/src/Chapter18.Tests/Listing18.01.Tests.cs @@ -0,0 +1,33 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_01.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = + @"Date +Day +DayOfWeek +DayOfYear +Hour +Kind +Millisecond +Minute +Month +Now +Second +Ticks +TimeOfDay +Today +Year +UtcNow"; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter18.Tests/Listing18.02.Tests.cs b/src/Chapter18.Tests/Listing18.02.Tests.cs new file mode 100644 index 000000000..2c57bacfb --- /dev/null +++ b/src/Chapter18.Tests/Listing18.02.Tests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_02.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @""; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter18.Tests/Listing18.06.Tests.cs b/src/Chapter18.Tests/Listing18.06.Tests.cs new file mode 100644 index 000000000..d93ac1489 --- /dev/null +++ b/src/Chapter18.Tests/Listing18.06.Tests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_06.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"Type parameter: System.Int32"; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter18.Tests/Listing18.16.Tests.cs b/src/Chapter18.Tests/Listing18.16.Tests.cs new file mode 100644 index 000000000..c56636e37 --- /dev/null +++ b/src/Chapter18.Tests/Listing18.16.Tests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_16.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"Help(?)"; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter18.Tests/Listing18.24.Tests.cs b/src/Chapter18.Tests/Listing18.24.Tests.cs new file mode 100644 index 000000000..17ee040ca --- /dev/null +++ b/src/Chapter18.Tests/Listing18.24.Tests.cs @@ -0,0 +1,19 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_24.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"Begin... +MethodA() executing... +End..."; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter18.Tests/Listing18.26.Tests.cs b/src/Chapter18.Tests/Listing18.26.Tests.cs new file mode 100644 index 000000000..ff1202db7 --- /dev/null +++ b/src/Chapter18.Tests/Listing18.26.Tests.cs @@ -0,0 +1,18 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_26.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"Hello! My name is Inigo Montoya +140.6 makes for a long triathlon."; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter18.Tests/Listing18.27.Tests.cs b/src/Chapter18.Tests/Listing18.27.Tests.cs new file mode 100644 index 000000000..5e2558e2b --- /dev/null +++ b/src/Chapter18.Tests/Listing18.27.Tests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_27.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"InigoMontoya"; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file diff --git a/src/Chapter18.Tests/Listing18.28.Tests.cs b/src/Chapter18.Tests/Listing18.28.Tests.cs new file mode 100644 index 000000000..415a87f25 --- /dev/null +++ b/src/Chapter18.Tests/Listing18.28.Tests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_28.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"Inigo Montoya"; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file From 3eaa94cd5cffa7158dcee70895facdf6d528bd7f Mon Sep 17 00:00:00 2001 From: Emma Spence Date: Tue, 23 Aug 2022 14:49:22 -0700 Subject: [PATCH 2/5] Added unit test for chapter 19 --- src/Chapter19.Tests/Listing19.06.Tests.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/Chapter19.Tests/Listing19.06.Tests.cs diff --git a/src/Chapter19.Tests/Listing19.06.Tests.cs b/src/Chapter19.Tests/Listing19.06.Tests.cs new file mode 100644 index 000000000..0643e0015 --- /dev/null +++ b/src/Chapter19.Tests/Listing19.06.Tests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter19.Listing19_06.Tests +{ + [TestClass] + public class ProgramTests + { + [TestMethod] + public void MainTest() + { + const string expected = @"ERROR: Operation is not valid due to the current state of the object."; + + IntelliTect.TestTools.Console.ConsoleAssert.Expect( + expected, Program.Main); + } + } +} \ No newline at end of file From cc7dec61fd85652d15c53735f6ab64c1540516bc Mon Sep 17 00:00:00 2001 From: Emma Spence Date: Tue, 23 Aug 2022 15:22:37 -0700 Subject: [PATCH 3/5] Got rid of chapter 18.01 unit test, will fix later --- src/Chapter18.Tests/Listing18.01.Tests.cs | 33 ----------------------- 1 file changed, 33 deletions(-) delete mode 100644 src/Chapter18.Tests/Listing18.01.Tests.cs diff --git a/src/Chapter18.Tests/Listing18.01.Tests.cs b/src/Chapter18.Tests/Listing18.01.Tests.cs deleted file mode 100644 index 592a9dffc..000000000 --- a/src/Chapter18.Tests/Listing18.01.Tests.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_01.Tests -{ - [TestClass] - public class ProgramTests - { - [TestMethod] - public void MainTest() - { - const string expected = - @"Date -Day -DayOfWeek -DayOfYear -Hour -Kind -Millisecond -Minute -Month -Now -Second -Ticks -TimeOfDay -Today -Year -UtcNow"; - - IntelliTect.TestTools.Console.ConsoleAssert.Expect( - expected, Program.Main); - } - } -} \ No newline at end of file From d54f52077c7db75fba3f09cee31df4e35edc9493 Mon Sep 17 00:00:00 2001 From: Emma Spence Date: Tue, 23 Aug 2022 15:33:43 -0700 Subject: [PATCH 4/5] Fixed locale issue in unit test 18.26 --- src/Chapter18.Tests/Listing18.26.Tests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Chapter18.Tests/Listing18.26.Tests.cs b/src/Chapter18.Tests/Listing18.26.Tests.cs index ff1202db7..64771a207 100644 --- a/src/Chapter18.Tests/Listing18.26.Tests.cs +++ b/src/Chapter18.Tests/Listing18.26.Tests.cs @@ -8,8 +8,8 @@ public class ProgramTests [TestMethod] public void MainTest() { - const string expected = @"Hello! My name is Inigo Montoya -140.6 makes for a long triathlon."; + string expected = $@"Hello! My name is Inigo Montoya +{140.6} makes for a long triathlon."; IntelliTect.TestTools.Console.ConsoleAssert.Expect( expected, Program.Main); From 3c181c5d3ddd0067e105ecec644574240ff31f31 Mon Sep 17 00:00:00 2001 From: Emma Spence Date: Wed, 7 Sep 2022 13:08:30 -0700 Subject: [PATCH 5/5] deleted unnecessary test 18.2 --- src/Chapter18.Tests/Listing18.02.Tests.cs | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 src/Chapter18.Tests/Listing18.02.Tests.cs diff --git a/src/Chapter18.Tests/Listing18.02.Tests.cs b/src/Chapter18.Tests/Listing18.02.Tests.cs deleted file mode 100644 index 2c57bacfb..000000000 --- a/src/Chapter18.Tests/Listing18.02.Tests.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter18.Listing18_02.Tests -{ - [TestClass] - public class ProgramTests - { - [TestMethod] - public void MainTest() - { - const string expected = @""; - - IntelliTect.TestTools.Console.ConsoleAssert.Expect( - expected, Program.Main); - } - } -} \ No newline at end of file