From e1eabdcee6a4ebd65da4e849629271741b4818e7 Mon Sep 17 00:00:00 2001 From: Kevin B Date: Thu, 26 Jan 2023 10:57:08 -0800 Subject: [PATCH 1/2] Proposed cleanup of list 7.32 --- src/Chapter07/Listing07.32.ListPatternMatching.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Chapter07/Listing07.32.ListPatternMatching.cs b/src/Chapter07/Listing07.32.ListPatternMatching.cs index 35e163378..b4fdaed4c 100644 --- a/src/Chapter07/Listing07.32.ListPatternMatching.cs +++ b/src/Chapter07/Listing07.32.ListPatternMatching.cs @@ -5,18 +5,18 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter07.Listing07_32; public class Program { #region INCLUDE - public static void Main(params string[] args) + public static void Main(string[] args) { - // For simplicitly, commands are assumed + // For simplicity, options are assumed // to all be lower case. - // The first argument is the command and is + // The first argument is the option and is // identified by a '/', '-', or '--' prefix. switch (args) { case ["--help" or ['/' or '-', 'h' or '?']]: - // e.g. /?, -?, /h, -h, --help + // e.g. --help, /h, -h, /?, -? DisplayHelp(); break; case [ ['/' or '-', char command], ..]: From 0f3cdec3649efb384f69239a43c5d972a8797065 Mon Sep 17 00:00:00 2001 From: Kevin Bost Date: Mon, 22 May 2023 09:22:24 -0700 Subject: [PATCH 2/2] Fixing tests --- src/Chapter07.Tests/Listing07.32.Tests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Chapter07.Tests/Listing07.32.Tests.cs b/src/Chapter07.Tests/Listing07.32.Tests.cs index fc034a79b..3d60673ff 100644 --- a/src/Chapter07.Tests/Listing07.32.Tests.cs +++ b/src/Chapter07.Tests/Listing07.32.Tests.cs @@ -18,7 +18,7 @@ public void ParseHelpCommand(string command) { command = item; IntelliTect.TestTools.Console.ConsoleAssert.Expect( - "Command Help...", () => Program.Main(command)); + "Command Help...", () => Program.Main(new[] { command })); } } @@ -31,7 +31,7 @@ public void ParseCatCommand(string command, string fileName) { command = $"{item}"; IntelliTect.TestTools.Console.ConsoleAssert.Expect( - $"Catalog '{fileName}'...", () => Program.Main(command, fileName)); + $"Catalog '{fileName}'...", () => Program.Main(new[] { command, fileName })); } } @@ -44,7 +44,7 @@ public void ParseCopyCommand(string command, string sourceFile, string targetFil { command = $"{item}"; IntelliTect.TestTools.Console.ConsoleAssert.Expect( - $"Copy '{sourceFile}' '{targetFile}'...", () => Program.Main(command, sourceFile, targetFile)); + $"Copy '{sourceFile}' '{targetFile}'...", () => Program.Main(new[] { command, sourceFile, targetFile })); } }