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("!")); } }
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("!")); } }