GetCharCount() private method

private GetCharCount ( byte bytes, int count ) : int
bytes byte
count int
return int
Esempio n. 1
0
 public void PosTest2()
 {
     Byte[] bytes = new Byte[] { };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int charCount = UTF7.GetCharCount(bytes, 0, 0);
     Assert.Equal(0, charCount);
 }
Esempio n. 2
0
 public void NegTest1()
 {
     Byte[] bytes = null;
     UTF7Encoding UTF7 = new UTF7Encoding();
     Assert.Throws<ArgumentNullException>(() =>
     {
         int charCount = UTF7.GetCharCount(bytes, 2, 8);
     });
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 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);
     });
 }
Esempio n. 6
0
 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);
 }
Esempio n. 7
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);
     });
 }
Esempio n. 8
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));
 }