public void PosTest2() { Byte[] bytes = new Byte[] { }; UTF7Encoding UTF7 = new UTF7Encoding(); int charCount = UTF7.GetCharCount(bytes, 0, 0); Assert.Equal(0, charCount); }
public static void Main() { 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); Console.WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); Console.Write("Decoded chars: "); foreach (Char c in chars) { Console.Write("[{0}]", c); } Console.WriteLine(); }
public void NegTest1() { Byte[] bytes = null; UTF7Encoding UTF7 = new UTF7Encoding(); Assert.Throws<ArgumentNullException>(() => { int charCount = UTF7.GetCharCount(bytes, 2, 8); }); }
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 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 NegTest4() { 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, bytes.Length, 6); }); }
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 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 NegTest4() { 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, bytes.Length, 6); }); }
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); }); }
public void NegTest4() { 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); }); }