GetCharCount() private method

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