public void CreateFallbackBuffer_Fallback_InvalidSurrogateChars_ThrowsArgumentOutOfRangeException() { EncoderFallbackBuffer buffer = new EncoderExceptionFallback().CreateFallbackBuffer(); Assert.Throws<ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0)); Assert.Throws<ArgumentOutOfRangeException>("CharUnknownLow", () => buffer.Fallback('\uD800', 'a', 0)); }
public void CreateFallbackBuffer_Fallback_InvalidSurrogateChars_ThrowsArgumentOutOfRangeException_Desktop() { EncoderFallbackBuffer buffer = new EncoderExceptionFallback().CreateFallbackBuffer(); Assert.Throws <ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0)); Assert.Throws <ArgumentOutOfRangeException>("CharUnknownLow", () => buffer.Fallback('\uD800', 'a', 0)); }
public void CreateFallbackBuffer() { EncoderFallbackBuffer buffer = new EncoderExceptionFallback().CreateFallbackBuffer(); Assert.Equal((char)0, buffer.GetNextChar()); Assert.False(buffer.MovePrevious()); Assert.Equal(0, buffer.Remaining); EncoderFallbackException ex = Assert.Throws<EncoderFallbackException>(() => buffer.Fallback('a', 0)); Assert.Equal('a', ex.CharUnknown); ex = Assert.Throws<EncoderFallbackException>(() => buffer.Fallback('\uD800', '\uDC00', 0)); Assert.Equal('\uD800', ex.CharUnknownHigh); Assert.Equal('\uDC00', ex.CharUnknownLow); }
public void CreateFallbackBuffer_Fallback_InvalidSurrogateChars_ThrowsArgumentOutOfRangeException() { EncoderFallbackBuffer buffer = new EncoderExceptionFallback().CreateFallbackBuffer(); Assert.Throws <ArgumentOutOfRangeException>("charUnknownHigh", () => buffer.Fallback('a', '\uDC00', 0)); Assert.Throws <ArgumentOutOfRangeException>( RuntimeDetection.IsNetFramework ? "CharUnknownLow" : "charUnknownLow", () => buffer.Fallback('\uD800', 'a', 0)); }
public void CreateFallbackBuffer() { EncoderFallbackBuffer buffer = new EncoderExceptionFallback().CreateFallbackBuffer(); Assert.Equal((char)0, buffer.GetNextChar()); Assert.False(buffer.MovePrevious()); Assert.Equal(0, buffer.Remaining); EncoderFallbackException ex = Assert.Throws <EncoderFallbackException>(() => buffer.Fallback('a', 0)); Assert.Equal('a', ex.CharUnknown); ex = Assert.Throws <EncoderFallbackException>(() => buffer.Fallback('\uD800', '\uDC00', 0)); Assert.Equal('\uD800', ex.CharUnknownHigh); Assert.Equal('\uDC00', ex.CharUnknownLow); }