public void PosTest2() { Byte[] bytes = new Byte[] { }; UTF7Encoding UTF7 = new UTF7Encoding(); int charCount = UTF7.GetCharCount(bytes, 0, 0); Assert.Equal(0, charCount); }
public void NegTest1() { Byte[] bytes = null; UTF7Encoding UTF7 = new UTF7Encoding(); Assert.Throws<ArgumentNullException>(() => { int charCount = UTF7.GetCharCount(bytes, 2, 8); }); }
public void PosTest2() { Char[] chars; Byte[] bytes = new Byte[] { }; UTF7Encoding UTF7 = new UTF7Encoding(); int charCount = UTF7.GetCharCount(bytes, 0, 0); chars = new Char[] { }; int charsDecodedCount = UTF7.GetChars(bytes, 0, 0, chars, 0); Assert.Equal(0, charsDecodedCount); }
public void PosTest1() { Byte[] bytes = new Byte[] { 85, 84, 70, 56, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 69, 120, 97, 109, 112, 108, 101}; UTF7Encoding UTF7 = new UTF7Encoding(); int charCount = UTF7.GetCharCount(bytes, 2, 8); Assert.Equal(8, charCount); }
public void NegTest3() { Byte[] bytes = new Byte[] { 85, 84, 70, 56, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 69, 120, 97, 109, 112, 108, 101}; UTF7Encoding UTF7 = new UTF7Encoding(); Assert.Throws<ArgumentOutOfRangeException>(() => { int charCount = UTF7.GetCharCount(bytes, 2, -1); }); }
public void PosTest1() { Char[] chars; Byte[] bytes = new Byte[] { 85, 84, 70, 55, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 69, 120, 97, 109, 112, 108, 101 }; UTF7Encoding UTF7 = new UTF7Encoding(); int charCount = UTF7.GetCharCount(bytes, 2, 8); chars = new Char[charCount]; int charsDecodedCount = UTF7.GetChars(bytes, 2, 8, chars, 0); }
public void NegTest3() { Char[] chars; Byte[] bytes = new Byte[] { 85, 84, 70, 55, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 69, 120, 97, 109, 112, 108, 101 }; UTF7Encoding UTF7 = new UTF7Encoding(); int charCount = UTF7.GetCharCount(bytes, 2, 8); chars = new Char[charCount]; Assert.Throws<ArgumentOutOfRangeException>(() => { int charsDecodedCount = UTF7.GetChars(bytes, -2, 8, chars, 0); }); }
/// <include file='doc\UTF7Encoding.uex' path='docs/doc[@for="UTF7Encoding.Decoder.GetCharCount"]/*' /> public override int GetCharCount(byte[] bytes, int index, int count) { return(encoding.GetCharCount(bytes, index, count, this)); }