Minor updates from Chapter 2 Review
MODIFY
src/Chapter02.Tests/Listing02.10.Tests.cs
src/Chapter02.Tests/Listing02.10.Tests.cs
@@ -8,7 +8,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter02.Listing02_10.Tests
[TestMethod]
public void Main_WriteBooleanStatements()
{
- const string expected = "1";
+ const string expected = "Help Requested: True";
IntelliTect.TestTools.Console.ConsoleAssert.Expect(
expected, Program.Main);

MODIFY
src/Chapter02/Listing02.09.FormattingUsingTheRFormatSpecifier.cs
src/Chapter02/Listing02.09.FormattingUsingTheRFormatSpecifier.cs
@@ -14,7 +14,7 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter02.Listing02_09
result = double.Parse(text);
Console.WriteLine($"{result == number}: {result} == {number}");
- text = string.Format("{0:R}", number);
+ text = $"{number:R}";
result = double.Parse(text);
Console.WriteLine($"{result == number}: {result} == {number}");

MODIFY
src/Chapter02/Listing02.10.CaseInsensitiveComparisonOfTwoStrings.cs
src/Chapter02/Listing02.10.CaseInsensitiveComparisonOfTwoStrings.cs
@@ -5,12 +5,15 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter02.Listing02_10
public static void Main()
{
#region INCLUDE
- string option = "help";
-
- int comparison = string.Compare(option, "/Help", true);
+ bool ignoreCase = true;
+ string option = "/help";
+ // ...
+ int comparison = string.Compare(option, "/Help", ignoreCase);
+ bool isHelpRequested = (comparison == 0);
+ // Displays: Help Requested: True
+ Console.WriteLine($"Help Requested: {isHelpRequested}");
#endregion INCLUDE
- Console.WriteLine($"{comparison}");
}
}
}

Minor updates from Chapter 2 Review