public void ApplyOrthographyConversion_NonAscii_SpecialCharsRecognizedAndConverted(string encodingStr) { // Parse test case parameter Encoding encoding = Encoding.Default; if (encodingStr == "utf8") { encoding = Encoding.UTF8; } else if (encodingStr.Equals("Unicode", StringComparison.OrdinalIgnoreCase) || encodingStr == "utf16" || encodingStr == "utf16le") { encoding = Encoding.Unicode; } else if (encodingStr.Equals("BigEndianUnicode", StringComparison.OrdinalIgnoreCase) || encodingStr == "utf16be") { encoding = Encoding.BigEndianUnicode; } // Setup the settings file that the System Under Test will read // Converts "άλφα" into "alpha" string[] lines = new string[] { "ά\ta", "λ\tl", "φ\tph", "α\ta" }; string tempFileName = Path.GetTempFileName(); File.WriteAllLines(tempFileName, lines, encoding); // Other Setup var fragments = new List <string>(); fragments.Add("άλφα"); // System Under Test List <string> mappedFragments = AudioSegmentationApi.ApplyOrthographyConversion(fragments, tempFileName).ToList(); // Cleanup File.Delete(tempFileName); // Verification Assert.That(mappedFragments[0], Is.EqualTo("alpha")); }
public void ApplyOrthographyConversion_Ascii_MapJToY() { // Setup string tempFileName = Path.GetTempFileName(); File.WriteAllText(tempFileName, "j\ty"); var fragments = new List <string>(); fragments.Add("jojo"); // System Under Test List <string> mappedFragments = AudioSegmentationApi.ApplyOrthographyConversion(fragments, tempFileName).ToList(); // Cleanup File.Delete(tempFileName); // Verification Assert.That(mappedFragments[0], Is.EqualTo("yoyo")); }