Beispiel #1
0
        private static void VerifyUtf7Encoding(UTF7Encoding encoding, bool allowOptionals)
        {
            Assert.Empty(encoding.GetPreamble());

            Assert.Equal(new EncoderReplacementFallback(string.Empty), encoding.EncoderFallback);
            Assert.Equal(1, encoding.DecoderFallback.MaxCharCount);
            Assert.Equal(984, encoding.DecoderFallback.GetHashCode());

            if (allowOptionals)
            {
                Assert.Equal(new byte[] { 33 }, encoding.GetBytes("!"));
            }
            else
            {
                Assert.Equal(new byte[] { 43, 65, 67, 69, 45 }, encoding.GetBytes("!"));
            }
        }
Beispiel #2
0
        public static void VerifyUtf7Encoding(UTF7Encoding encoding, bool allowOptionals)
        {
            Assert.Empty(encoding.GetPreamble());

            Assert.Equal(new EncoderReplacementFallback(string.Empty), encoding.EncoderFallback);
            Assert.Equal(1, encoding.DecoderFallback.MaxCharCount);
            Assert.Equal(984, encoding.DecoderFallback.GetHashCode());

            if (allowOptionals)
            {
                Assert.Equal(new byte[] { 33 }, encoding.GetBytes("!"));
            }
            else
            {
                Assert.Equal(new byte[] { 43, 65, 67, 69, 45 }, encoding.GetBytes("!"));
            }
            
        }