예제 #1
0
 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();
    }
예제 #3
0
        public void PosTest2()
        {
            Byte[]       bytes     = new Byte[] { };
            UTF7Encoding UTF7      = new UTF7Encoding();
            int          charCount = UTF7.GetCharCount(bytes, 0, 0);

            Assert.Equal(0, charCount);
        }
예제 #4
0
 public void NegTest1()
 {
     Byte[] bytes = null;
     UTF7Encoding UTF7 = new UTF7Encoding();
     Assert.Throws<ArgumentNullException>(() =>
     {
         int charCount = UTF7.GetCharCount(bytes, 2, 8);
     });
 }
예제 #5
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);
 }
예제 #6
0
        public void NegTest1()
        {
            Byte[]       bytes = null;
            UTF7Encoding UTF7  = new UTF7Encoding();

            Assert.Throws <ArgumentNullException>(() =>
            {
                int charCount = UTF7.GetCharCount(bytes, 2, 8);
            });
        }
예제 #7
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);
 }
예제 #8
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);
        }
예제 #9
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);
     });
 }
예제 #10
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);
        }
예제 #11
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);
 }
예제 #12
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);
        }
예제 #13
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);
            });
        }
예제 #14
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);
     });
 }
예제 #15
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);
            });
        }