From d8e4e0d975b8c3c7e7ae6a20340266b796994d09 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Tue, 15 Feb 2022 21:57:21 +1100 Subject: [PATCH] Extract IO string constants --- 00_Common/dotnet/Games.Common.Test/IO/TokenReaderTests.cs | 4 +--- 00_Common/dotnet/Games.Common/IO/Strings.cs | 8 ++++++++ 00_Common/dotnet/Games.Common/IO/TokenReader.cs | 5 ++--- 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 00_Common/dotnet/Games.Common/IO/Strings.cs diff --git a/00_Common/dotnet/Games.Common.Test/IO/TokenReaderTests.cs b/00_Common/dotnet/Games.Common.Test/IO/TokenReaderTests.cs index 3a4b9e9b..65b33908 100644 --- a/00_Common/dotnet/Games.Common.Test/IO/TokenReaderTests.cs +++ b/00_Common/dotnet/Games.Common.Test/IO/TokenReaderTests.cs @@ -6,14 +6,12 @@ using FluentAssertions.Execution; using Xunit; using static System.Environment; +using static Games.Common.IO.Strings; namespace Games.Common.IO { public class TokenReaderTests { - const string NumberExpected = "!Number expected - retry input line"; - const string ExtraInput = "!Extra input ignored"; - private readonly StringWriter _outputWriter; public TokenReaderTests() diff --git a/00_Common/dotnet/Games.Common/IO/Strings.cs b/00_Common/dotnet/Games.Common/IO/Strings.cs new file mode 100644 index 00000000..3d955409 --- /dev/null +++ b/00_Common/dotnet/Games.Common/IO/Strings.cs @@ -0,0 +1,8 @@ +namespace Games.Common.IO +{ + internal static class Strings + { + internal const string NumberExpected = "!Number expected - retry input line"; + internal const string ExtraInput = "!Extra input ignored"; + } +} \ No newline at end of file diff --git a/00_Common/dotnet/Games.Common/IO/TokenReader.cs b/00_Common/dotnet/Games.Common/IO/TokenReader.cs index f2046dc3..b7eb3774 100644 --- a/00_Common/dotnet/Games.Common/IO/TokenReader.cs +++ b/00_Common/dotnet/Games.Common/IO/TokenReader.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; +using static Games.Common.IO.Strings; + namespace Games.Common.IO { internal class TokenReader { - private const string NumberExpected = "!Number expected - retry input line"; - private const string ExtraInput = "!Extra input ignored"; - private readonly TextIO _io; private readonly Predicate _isTokenValid;