예제 #1
0
        public void CreateFallbackBuffer_Fallback_InvalidSurrogateChars_ThrowsArgumentOutOfRangeException_Desktop()
        {
            EncoderFallbackBuffer buffer = new EncoderReplacementFallback().CreateFallbackBuffer();

            Assert.Throws <ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0));
            Assert.Throws <ArgumentOutOfRangeException>("CharUnknownLow", () => buffer.Fallback('\uD800', 'a', 0));
        }
예제 #2
0
        public void CreateFallbackBuffer_MultipleFallback_ThrowsArgumentException(string replacement)
        {
            EncoderFallbackBuffer buffer = new EncoderReplacementFallback(replacement).CreateFallbackBuffer();

            buffer.Fallback('a', 0);

            AssertExtensions.Throws <ArgumentException>("chars", () => buffer.Fallback('a', 0));
            AssertExtensions.Throws <ArgumentException>("chars", () => buffer.Fallback('\uD800', '\uDC00', 0));
        }
예제 #3
0
        public void CreateFallbackBuffer_Fallback_Char(string replacement, char charUnknown, bool expected)
        {
            EncoderFallbackBuffer buffer = new EncoderReplacementFallback(replacement).CreateFallbackBuffer();

            Assert.Equal(expected, buffer.Fallback(charUnknown, 0));
        }
예제 #4
0
        public void CreateFallbackBuffer_Fallback_Char_Char(string replacement, bool expected)
        {
            EncoderFallbackBuffer buffer = new EncoderReplacementFallback(replacement).CreateFallbackBuffer();

            Assert.Equal(expected, buffer.Fallback('\uD800', '\uDC00', 0));
        }
 public void CreateFallbackBuffer_Fallback_Char_Char(string replacement, bool expected)
 {
     EncoderFallbackBuffer buffer = new EncoderReplacementFallback(replacement).CreateFallbackBuffer();
     Assert.Equal(expected, buffer.Fallback('\uD800', '\uDC00', 0));
 }
        public void CreateFallbackBuffer_MultipleFallback_ThrowsArgumentException(string replacement)
        {
            EncoderFallbackBuffer buffer = new EncoderReplacementFallback(replacement).CreateFallbackBuffer();
            buffer.Fallback('a', 0);

            Assert.Throws<ArgumentException>("chars", () => buffer.Fallback('a', 0));
            Assert.Throws<ArgumentException>("chars", () => buffer.Fallback('\uD800', '\uDC00', 0));
        }
 public void CreateFallbackBuffer_Fallback_Char(string replacement, char charUnknown, bool expected)
 {
     EncoderFallbackBuffer buffer = new EncoderReplacementFallback(replacement).CreateFallbackBuffer();
     Assert.Equal(expected, buffer.Fallback(charUnknown, 0));
 }
        public void CreateFallbackBuffer_Fallback_InvalidSurrogateChars_ThrowsArgumentOutOfRangeException()
        {
            EncoderFallbackBuffer buffer = new EncoderReplacementFallback().CreateFallbackBuffer();

            Assert.Throws<ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0));
            Assert.Throws<ArgumentOutOfRangeException>("CharUnknownLow", () => buffer.Fallback('\uD800', 'a', 0));
        }