From 391b82bdd71e8ecb12a105075891f3e6a6b851c1 Mon Sep 17 00:00:00 2001 From: "Bruni, Ottorino" Date: Thu, 23 May 2024 08:43:59 +0200 Subject: [PATCH] Fix Tests --- README.md | 26 ++++++- .../CapitaliseCaseConverterTest.cs | 4 +- .../CapitaliseWordsCaseConverterTest.cs | 8 +-- TextCase.UnitTests/CobolCaseConverterTest.cs | 24 +++++++ .../ConstantCaseConverterTest.cs | 24 +++++++ .../HashtagCaseConverterTest.cs | 10 +-- .../InverseCaseConverterTest.cs | 44 ++++++++++++ TextCase.UnitTests/PascalCaseConverterTest.cs | 20 ++++++ TextCase.UnitTests/TrainCaseConverterTest.cs | 61 +++++++++++++++++ TextCase/Converters/HashtagCaseConverter.cs | 10 +-- TextCase/Converters/InverseCaseConverter.cs | 40 +++++++++++ TextCase/Converters/TrainCaseConverter.cs | 41 +++++++++++ TextCase/Extensions/StringExtensions.cs | 68 +++++++++++++++---- TextCase/TextCase.cs | 10 ++- TextCase/TextCase.csproj | 2 +- TextCase/TextCaseFactory.cs | 10 ++- 16 files changed, 362 insertions(+), 40 deletions(-) create mode 100644 TextCase.UnitTests/InverseCaseConverterTest.cs create mode 100644 TextCase.UnitTests/TrainCaseConverterTest.cs create mode 100644 TextCase/Converters/InverseCaseConverter.cs create mode 100644 TextCase/Converters/TrainCaseConverter.cs diff --git a/README.md b/README.md index 6dfb229..ad5bf4f 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,11 @@ There are the cases currently available: - PascalCase - KebabCase - SnackCase -- HashtagCase +- HashTagCase +- ConstantCase +- CobolCase +- InverseCase +- TrainCase It's possible to count in the text: - number of characters @@ -73,8 +77,24 @@ TextCase.Convert("You talking to me?", Case.SnackCase); "You talking to me?".ToSnackCase(); // #You #talking #to #me? -TextCase.Convert("You talking to me?", Case.HashtagCase); -"You talking to me?".ToHashtagCase(); +TextCase.Convert("You talking to me?", Case.HashTagCase); +"You talking to me?".ToHashTagCase(); + +// YOU_TALKING_TO_ME +TextCase.Convert("You talking to me?", Case.ConstantCase); +"You talking to me?".ToConstantCase(); + +// YOU-TALKING-TO-ME +TextCase.Convert("You talking to me?", Case.CobolCase); +"You talking to me?".ToCobolCase(); + +// yOu TaLkInG tO mE? +TextCase.Convert("You talking to me?", Case.InverseCase); +"You talking to me?".ToInverseCase(); + +// You-Talking-To-Me +TextCase.Convert("You talking to me?", Case.TrainCase); +"You talking to me?".ToTrainCase(); // Text Count TextCase.GetTextCount("You talking to me?"); diff --git a/TextCase.UnitTests/CapitaliseCaseConverterTest.cs b/TextCase.UnitTests/CapitaliseCaseConverterTest.cs index 4f1e89f..130c9bb 100644 --- a/TextCase.UnitTests/CapitaliseCaseConverterTest.cs +++ b/TextCase.UnitTests/CapitaliseCaseConverterTest.cs @@ -29,10 +29,10 @@ public void Convert_WhenCapitaliseCase_TextShouldBeCapitaliseCase(string input, [InlineData("Hello World", "Hello world")] [InlineData("ICH BIN GLÜCKLICH", "Ich bin glücklich")] [InlineData(" che ore SONO? ", "Che ore sono?")] - public void ToCapitaliseCase_WhenCapitaliseCase_TextShouldBeCapitaliseCase(string input, string output) + public void ToCapitalizeCase_WhenCapitalizeCase_TextShouldBeCapitalizeCase(string input, string output) { // Execute - var convertedText = input.ToCapitaliseCase(); + var convertedText = input.ToCapitalizeCase(); // Assert var expected = output; diff --git a/TextCase.UnitTests/CapitaliseWordsCaseConverterTest.cs b/TextCase.UnitTests/CapitaliseWordsCaseConverterTest.cs index ba94ebc..fb5ad99 100644 --- a/TextCase.UnitTests/CapitaliseWordsCaseConverterTest.cs +++ b/TextCase.UnitTests/CapitaliseWordsCaseConverterTest.cs @@ -5,13 +5,13 @@ namespace TextCase.UnitTests { - public class CapitaliseWordsCaseConverterTest + public class CapitalizeWordsCaseConverterTest { [Theory] [InlineData("Hello World", "Hello World")] [InlineData("ICH BIN GLÜCKLICH", "Ich Bin Glücklich")] [InlineData(" che ore SONO? ", " Che Ore Sono? ")] - public void Convert_WhenCapitaliseCase_TextShouldBeCapitaliseCase(string input, string output) + public void Convert_WhenCapitalizeCase_TextShouldBeCapitalizeCase(string input, string output) { // Setup var service = new CapitaliseWordsCaseConverter(); @@ -29,10 +29,10 @@ public void Convert_WhenCapitaliseCase_TextShouldBeCapitaliseCase(string input, [InlineData("Hello World", "Hello World")] [InlineData("ICH BIN GLÜCKLICH", "Ich Bin Glücklich")] [InlineData(" che ore SONO? ", " Che Ore Sono? ")] - public void ToCapitaliseWordsCase_WhenCapitaliseCase_TextShouldBeCapitaliseCase(string input, string output) + public void ToCapitalizeWordsCase_WhenCapitalizeCase_TextShouldBeCapitalizeCase(string input, string output) { // Execute - var convertedText = input.ToCapitaliseWordsCase(); + var convertedText = input.ToCapitalizeWordsCase(); // Assert var expected = output; diff --git a/TextCase.UnitTests/CobolCaseConverterTest.cs b/TextCase.UnitTests/CobolCaseConverterTest.cs index f187ba4..f79847f 100644 --- a/TextCase.UnitTests/CobolCaseConverterTest.cs +++ b/TextCase.UnitTests/CobolCaseConverterTest.cs @@ -1,4 +1,5 @@ using TextCase.Converters; +using TextCase.Extensions; using Xunit; namespace TextCase.UnitTests @@ -28,5 +29,28 @@ public void Convert_WhenConstantCase_TextShouldBeConstantCase(string input, stri // Assert Assert.Equal(expected, actual); } + + [Theory] + [InlineData("hello world", "HELLO-WORLD")] + [InlineData("icH bIn glückLICH", "ICH-BIN-GLÜCKLICH")] + [InlineData("indent_style = space, 2-\nindent_size = 2", "INDENT-STYLE-SPACE-2\nINDENT-SIZE-2")] + [InlineData("Hello World!", "HELLO-WORLD")] + [InlineData("123 test", "123-TEST")] + [InlineData("test with multiple spaces", "TEST-WITH-MULTIPLE-SPACES")] + [InlineData("test_with_underscore", "TEST-WITH-UNDERSCORE")] + [InlineData("test-with-dash", "TEST-WITH-DASH")] + [InlineData("test.with.period", "TEST-WITH-PERIOD")] + [InlineData("test/with/slash", "TEST-WITH-SLASH")] + [InlineData("test\\with\\backslash", "TEST-WITH-BACKSLASH")] + public void ToCobolCase_WhenCobolCase_TextShouldBeCobolCase(string input, string output) + { + // Execute + var convertedText = input.ToCobolCase(); + + // Assert + var expected = output; + var actual = convertedText; + Assert.Equal(expected, actual); + } } } \ No newline at end of file diff --git a/TextCase.UnitTests/ConstantCaseConverterTest.cs b/TextCase.UnitTests/ConstantCaseConverterTest.cs index d972194..5592c1d 100644 --- a/TextCase.UnitTests/ConstantCaseConverterTest.cs +++ b/TextCase.UnitTests/ConstantCaseConverterTest.cs @@ -1,4 +1,5 @@ using TextCase.Converters; +using TextCase.Extensions; using Xunit; namespace TextCase.UnitTests @@ -28,5 +29,28 @@ public void Convert_WhenConstantCase_TextShouldBeConstantCase(string input, stri // Assert Assert.Equal(expected, actual); } + + [Theory] + [InlineData("hello world", "HELLO_WORLD")] + [InlineData("icH bIn glückLICH", "ICH_BIN_GLÜCKLICH")] + [InlineData("indent_style = space, 2-\nindent_size = 2", "INDENT_STYLE_SPACE_2\nINDENT_SIZE_2")] + [InlineData("Hello World!", "HELLO_WORLD")] + [InlineData("123 test", "123_TEST")] + [InlineData("test with multiple spaces", "TEST_WITH_MULTIPLE_SPACES")] + [InlineData("test_with_underscore", "TEST_WITH_UNDERSCORE")] + [InlineData("test-with-dash", "TEST_WITH_DASH")] + [InlineData("test.with.period", "TEST_WITH_PERIOD")] + [InlineData("test/with/slash", "TEST_WITH_SLASH")] + [InlineData("test\\with\\backslash", "TEST_WITH_BACKSLASH")] + public void ToConstantCase_WhenConstantCase_TextShouldBeConstantCase(string input, string output) + { + // Execute + var convertedText = input.ToConstantCase(); + + // Assert + var expected = output; + var actual = convertedText; + Assert.Equal(expected, actual); + } } } \ No newline at end of file diff --git a/TextCase.UnitTests/HashtagCaseConverterTest.cs b/TextCase.UnitTests/HashtagCaseConverterTest.cs index ce0b734..38c647a 100644 --- a/TextCase.UnitTests/HashtagCaseConverterTest.cs +++ b/TextCase.UnitTests/HashtagCaseConverterTest.cs @@ -5,16 +5,16 @@ namespace TextCase.UnitTests { - public class HashtagCaseConverterTest + public class HashTagCaseConverterTest { [Theory] [InlineData("hello world", "#hello #world")] [InlineData("icH bIn glückLICH", "#icH #bIn #glückLICH")] [InlineData(" che ore sono? ", "#che #ore #sono?")] - public void Convert_WhenHashtagCase_TextShouldBeHashtagCase(string input, string output) + public void Convert_WhenHashTagCase_TextShouldBeHashTagCase(string input, string output) { // Setup - var service = new HashtagCaseConverter(); + var service = new HashTagCaseConverter(); // Execute var convertedText = service.Convert(input); @@ -29,10 +29,10 @@ public void Convert_WhenHashtagCase_TextShouldBeHashtagCase(string input, string [InlineData("hello world", "#hello #world")] [InlineData("icH bIn glückLICH", "#icH #bIn #glückLICH")] [InlineData(" che ore sono? ", "#che #ore #sono?")] - public void ToHashtagCase_WhenHashtagCase_TextShouldBeHashtagCase(string input, string output) + public void ToHashTagCase_WhenHashTagCase_TextShouldBeHashTagCase(string input, string output) { // Execute - var convertedText = input.ToHashtagCase(); + var convertedText = input.ToHashTagCase(); // Assert var expected = output; diff --git a/TextCase.UnitTests/InverseCaseConverterTest.cs b/TextCase.UnitTests/InverseCaseConverterTest.cs new file mode 100644 index 0000000..773e7a0 --- /dev/null +++ b/TextCase.UnitTests/InverseCaseConverterTest.cs @@ -0,0 +1,44 @@ +using System; +using TextCase.Converters; +using TextCase.Extensions; +using Xunit; + +namespace TextCase.UnitTests +{ + public class InverseCaseConverterTest + { + [Theory] + [InlineData("hello world", "hElLo WoRlD")] + [InlineData("icH bIn glückLICH", "iCh BiN gLüCkLiCh")] + [InlineData(" che ore sono? ", " cHe OrE sOnO? ")] + public void Convert_WhenCamelCase_TextShouldBeCamelCase(string input, string output) + { + // Setup + var service = new InverseCaseConverter(); + + // Execute + var convertedText = service.Convert(input); + + // Assert + var expected = output; + var actual = convertedText; + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData("hello world", "hElLo WoRlD")] + [InlineData("icH bIn glückLICH", "iCh BiN gLüCkLiCh")] + [InlineData(" che ore sono? ", " cHe OrE sOnO? ")] + [InlineData("You talking to me?", "yOu TaLkInG tO mE?")] + public void ToInverseCase_WhenCamelCase_TextShouldBeCamelCase(string input, string output) + { + // Execute + var convertedText = input.ToInverseCase(); + + // Assert + var expected = output; + var actual = convertedText; + Assert.Equal(expected, actual); + } + } +} \ No newline at end of file diff --git a/TextCase.UnitTests/PascalCaseConverterTest.cs b/TextCase.UnitTests/PascalCaseConverterTest.cs index 587a391..9bb77af 100644 --- a/TextCase.UnitTests/PascalCaseConverterTest.cs +++ b/TextCase.UnitTests/PascalCaseConverterTest.cs @@ -1,5 +1,6 @@ using System; using TextCase.Converters; +using TextCase.Extensions; using Xunit; namespace TextCase.UnitTests @@ -27,5 +28,24 @@ public void Convert_WhenPascalCase_TextShouldBePascalCase(string input, string o var actual = convertedText; Assert.Equal(expected, actual); } + + [Theory] + [InlineData("hello world", "HelloWorld")] + [InlineData("icH bIn glückLICH", "IchBinGlücklich")] + [InlineData(" che ore sono? ", "CheOreSono?")] + [InlineData("iPhone", "Iphone")] + [InlineData(" Hello World ", "HelloWorld")] + [InlineData("hello\tworld", "HelloWorld")] + [InlineData("Hello\nWorld", "HelloWorld")] + public void ToPascalCase_WhenUpperCase_TextShouldBePascalCase(string input, string output) + { + // Execute + var convertedText = input.ToPascalCase(); + + // Assert + var expected = output; + var actual = convertedText; + Assert.Equal(expected, actual); + } } } \ No newline at end of file diff --git a/TextCase.UnitTests/TrainCaseConverterTest.cs b/TextCase.UnitTests/TrainCaseConverterTest.cs new file mode 100644 index 0000000..208d7a8 --- /dev/null +++ b/TextCase.UnitTests/TrainCaseConverterTest.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TextCase.Converters; +using TextCase.Extensions; +using Xunit; + +namespace TextCase.UnitTests +{ + public class TrainCaseConverterTest + { + [Theory] + [InlineData("hello world", "Hello-World")] + [InlineData("icH bIn glückLICH", "Ich-Bin-Glücklich")] + [InlineData("indent_style = space, 2-\nindent_size = 2", "Indent-Style-Space-2\nIndent-Size-2")] + [InlineData("Hello World!", "Hello-World")] + [InlineData("123 test", "123-Test")] + [InlineData("test with multiple spaces", "Test-With-Multiple-Spaces")] + [InlineData("test_with_underscore", "Test-With-Underscore")] + [InlineData("test-with-dash", "Test-With-Dash")] + [InlineData("test.with.period", "Test-With-Period")] + [InlineData("test/with/slash", "Test-With-Slash")] + [InlineData("test\\with\\backslash", "Test-With-Backslash")] + public void Convert_WhenTrainCase_TextShouldBeTrainCase(string input, string expected) + { + // Setup + var service = new TrainCaseConverter(); + + // Execute + var actual = service.Convert(input); + + // Assert + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData("hello world", "Hello-World")] + [InlineData("icH bIn glückLICH", "Ich-Bin-Glücklich")] + [InlineData("indent_style = space, 2-\nindent_size = 2", "Indent-Style-Space-2\nIndent-Size-2")] + [InlineData("Hello World!", "Hello-World")] + [InlineData("123 test", "123-Test")] + [InlineData("test with multiple spaces", "Test-With-Multiple-Spaces")] + [InlineData("test_with_underscore", "Test-With-Underscore")] + [InlineData("test-with-dash", "Test-With-Dash")] + [InlineData("test.with.period", "Test-With-Period")] + [InlineData("test/with/slash", "Test-With-Slash")] + [InlineData("test\\with\\backslash", "Test-With-Backslash")] + public void ToTrainCase_WhenTrainCase_TextShouldBeTrainCase(string input, string output) + { + // Execute + var convertedText = input.ToTrainCase(); + + // Assert + var expected = output; + var actual = convertedText; + Assert.Equal(expected, actual); + } + } +} diff --git a/TextCase/Converters/HashtagCaseConverter.cs b/TextCase/Converters/HashtagCaseConverter.cs index e9728d6..8236093 100644 --- a/TextCase/Converters/HashtagCaseConverter.cs +++ b/TextCase/Converters/HashtagCaseConverter.cs @@ -4,15 +4,15 @@ namespace TextCase.Converters { /// - /// Represents a hashtag converter + /// Represents a hash-tag converter /// - public class HashtagCaseConverter : ICaseConverter + public class HashTagCaseConverter : ICaseConverter { /// - /// Converts the specified text to hashtag case. + /// Converts the specified text to hash-tag case. /// - /// The string to convert to hashtag case. - /// The specified text converted to hashtag case. + /// The string to convert to hash-tag case. + /// The specified text converted to hash-tag case. public string Convert(string text) { if (string.IsNullOrWhiteSpace(text)) diff --git a/TextCase/Converters/InverseCaseConverter.cs b/TextCase/Converters/InverseCaseConverter.cs new file mode 100644 index 0000000..a90fee4 --- /dev/null +++ b/TextCase/Converters/InverseCaseConverter.cs @@ -0,0 +1,40 @@ +using System; +using System.Globalization; +using System.Text; +using TextCase.Extensions; + +namespace TextCase.Converters +{ + /// + /// Represents an inverse converter + /// + public class InverseCaseConverter : ICaseConverter + { + /// + /// Converts the specified text to inverse case. + /// + /// The string to convert to inverse case. + /// The specified text converted to inverse case. + public string Convert(string text) + { + if (string.IsNullOrWhiteSpace(text)) + { + return string.Empty; + } + + var builder = new StringBuilder(); + var isUpper = false; + + foreach (var c in text) + { + builder.Append(isUpper ? char.ToUpperInvariant(c) : char.ToLowerInvariant(c)); + if (!char.IsWhiteSpace(c)) + { + isUpper = !isUpper; + } + } + + return builder.ToString(); + } + } +} diff --git a/TextCase/Converters/TrainCaseConverter.cs b/TextCase/Converters/TrainCaseConverter.cs new file mode 100644 index 0000000..29f7e6b --- /dev/null +++ b/TextCase/Converters/TrainCaseConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace TextCase.Converters +{ + /// + /// Represents a train case converter + /// + public class TrainCaseConverter : ICaseConverter + { + /// + /// Converts the specified text to train case. + /// + /// The string to convert to train case. + /// The specified text converted to train case. + public string Convert(string text) + { + if (string.IsNullOrWhiteSpace(text)) + { + return string.Empty; + } + + // Replace one or more consecutive non-letter, non-digit, non-newline characters with a single dash + var replacedPunctuation = Regex.Replace(text, @"[^\p{L}0-9\n]+", "-"); + + // Split the text into lines + var lines = replacedPunctuation.Split('\n'); + + // Convert each line to title case and trim leading and trailing dashes + var processedLines = lines.Select(line => CultureInfo.InvariantCulture.TextInfo.ToTitleCase(line.ToLowerInvariant()).Trim('-')); + + // Join the lines back together + return string.Join("\n", processedLines); + } + } +} diff --git a/TextCase/Extensions/StringExtensions.cs b/TextCase/Extensions/StringExtensions.cs index 72f8c6e..20331f7 100644 --- a/TextCase/Extensions/StringExtensions.cs +++ b/TextCase/Extensions/StringExtensions.cs @@ -103,23 +103,23 @@ public static string ToTitleCase(this string value) } /// - /// Converts the specified text to capitalise case. + /// Converts the specified text to capitalize case. /// - /// The string to convert to capitalise case. - /// The specified text converted to capitalise case. - public static string ToCapitaliseCase(this string value) + /// The string to convert to capitalize case. + /// The specified text converted to capitalize case. + public static string ToCapitalizeCase(this string value) { - return TextCase.Convert(value, Case.CapitaliseCase); - } - + return TextCase.Convert(value, Case.CapitalizeCase); + } + /// - /// Converts the specified text to capitalise words case. + /// Converts the specified text to capitalize words case. /// - /// The string to convert to capitalise words case. - /// The specified text converted to capitalise words case. - public static string ToCapitaliseWordsCase(this string value) + /// The string to convert to capitalize words case. + /// The specified text converted to capitalize words case. + public static string ToCapitalizeWordsCase(this string value) { - return TextCase.Convert(value, Case.CapitaliseWordsCase); + return TextCase.Convert(value, Case.CapitalizeWordsCase); } /// @@ -187,9 +187,49 @@ public static string ToSnackCase(this string value) /// /// The string to convert to hashtag case. /// The specified text converted to hashtag case. - public static string ToHashtagCase(this string value) + public static string ToHashTagCase(this string value) + { + return TextCase.Convert(value, Case.HashTagCase); + } + + /// + /// Converts the specified text to constant case. + /// + /// The string to convert to constant case. + /// The specified text converted to constant case. + public static string ToConstantCase(this string value) + { + return TextCase.Convert(value, Case.ConstantCase); + } + + /// + /// Converts the specified text to cobol case. + /// + /// The string to convert to cobol case. + /// The specified text converted to cobol case. + public static string ToCobolCase(this string value) + { + return TextCase.Convert(value, Case.CobolCase); + } + + /// + /// Converts the specified text to inverse case. + /// + /// The string to convert to inverse case. + /// The specified text converted to inverse case. + public static string ToInverseCase(this string value) + { + return TextCase.Convert(value, Case.InverseCase); + } + + /// + /// Converts the specified text to train case. + /// + /// The string to convert to train case. + /// The specified text converted to train case. + public static string ToTrainCase(this string value) { - return TextCase.Convert(value, Case.HashtagCase); + return TextCase.Convert(value, Case.TrainCase); } } } diff --git a/TextCase/TextCase.cs b/TextCase/TextCase.cs index 281912f..b1ca174 100644 --- a/TextCase/TextCase.cs +++ b/TextCase/TextCase.cs @@ -9,15 +9,19 @@ public enum Case UpperCase, LowerCase, TitleCase, - CapitaliseCase, - CapitaliseWordsCase, + CapitalizeCase, + CapitalizeWordsCase, ReverseCase, AlternateCase, CamelCase, PascalCase, KebabCase, SnackCase, - HashtagCase + HashTagCase, + ConstantCase, + CobolCase, + TrainCase, + InverseCase } public static class TextCase diff --git a/TextCase/TextCase.csproj b/TextCase/TextCase.csproj index ef91483..acb80d8 100644 --- a/TextCase/TextCase.csproj +++ b/TextCase/TextCase.csproj @@ -2,7 +2,7 @@ net8.0 TextCase - 1.0.7 + 1.0.8 Ottorino Bruni The TextCase library for .NET helps changing the cases of existing texts. true diff --git a/TextCase/TextCaseFactory.cs b/TextCase/TextCaseFactory.cs index c2bcdf8..d68bbf2 100644 --- a/TextCase/TextCaseFactory.cs +++ b/TextCase/TextCaseFactory.cs @@ -12,15 +12,19 @@ internal static ICaseConverter GetCaseConverter(Case textCase) Case.UpperCase => new UpperCaseConverter(), Case.LowerCase => new LowerCaseConverter(), Case.TitleCase => new TitleCaseConverter(), - Case.CapitaliseCase => new CapitaliseCaseConverter(), - Case.CapitaliseWordsCase => new CapitaliseWordsCaseConverter(), + Case.CapitalizeCase => new CapitaliseCaseConverter(), + Case.CapitalizeWordsCase => new CapitaliseWordsCaseConverter(), Case.ReverseCase => new ReverseCaseConverter(), Case.AlternateCase => new AlternateCaseConverter(), Case.CamelCase => new CamelCaseConverter(), Case.PascalCase => new PascalCaseConverter(), Case.KebabCase => new KebabCaseConverter(), Case.SnackCase => new SnackCaseConverter(), - Case.HashtagCase => new HashtagCaseConverter(), + Case.HashTagCase => new HashTagCaseConverter(), + Case.ConstantCase => new ConstantCaseConverter(), + Case.CobolCase => new CobolCaseConverter(), + Case.TrainCase => new TrainCaseConverter(), + Case.InverseCase => new InverseCaseConverter(), _ => throw new ArgumentException("No valid TextCase"), }; }