Пример #1
0
        public void CharacterToNumbersIsNoopForEmptyOrNullInput()
        {
            string input = "";

            Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint(input), Is.EqualTo(input), "Don't change if empty string");
            input = null;
            Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint(input), Is.EqualTo(input), "Don't change if null");
        }
Пример #2
0
        public void CharacterToNumbersDoesNotOperateOnSurrogates()
        {
            string input;

            input = "\uD834\uDD1E";
            Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint(input), Is.EqualTo(input), "Don't operate on surrogates");
            input = "\U0001D11E";
            Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint(input), Is.EqualTo(input), "Don't operate on the resulting surrogates");
        }
Пример #3
0
 public void CharacterToNumbersConvertsFinal()
 {
     Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint("A"), Is.EqualTo("0041"), "should have converted final character to four hex-digit unicode representation");
     Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint("AA"), Is.EqualTo("A0041"));
     Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint("1234A"), Is.EqualTo("12340041"));
     Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint("\u1234"), Is.EqualTo("1234"));
     Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint("AA\u1234"), Is.EqualTo("AA1234"));
     Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint("AA5555"), Is.EqualTo("AA5550035"), "Should have converted final character to four hex-digit representation");
     Assert.That(UnicodeCharacterEditingHelper.ConvertFinalCharacterToCodepoint("AB\nBA"), Is.EqualTo("AB\nB0041"), "Should have worked even with a newline character in input");
 }