Пример #1
0
        public void UnixAndMacCRLF()
        {
            QPEncoder qpencoder = QPEncoder.GetInstance();

            Assert.AreEqual("123\r\n456\r\n789", qpencoder.EncodeString("123\r456\r789\r", System.Text.Encoding.GetEncoding("iso-8859-1")));
            Assert.AreEqual("123\r\n456\r\n789", qpencoder.EncodeString("123\n456\n789\n", System.Text.Encoding.GetEncoding("iso-8859-1")));
        }
Пример #2
0
        public void EndOfLineSpacesTest()
        {
            QPEncoder qpencoder = QPEncoder.GetInstance();

            Assert.AreEqual("123 456  7890=20=20=20=20=20", qpencoder.EncodeString("123 456  7890     ", System.Text.Encoding.GetEncoding("iso-8859-1")));
            Assert.AreEqual("=20=20=20=20=20", qpencoder.EncodeString("     ", System.Text.Encoding.GetEncoding("iso-8859-1")));
            Assert.AreEqual("123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456=\r\n7890=20=20=20", qpencoder.EncodeString("123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234567890   ", System.Text.Encoding.GetEncoding("iso-8859-1")));
            Assert.AreEqual("123456789 123456789 123456789 123456789 123456789 123456789 123456789=\r\n=20=20=20=20=20=20=20=20=20=20=20", qpencoder.EncodeString("123456789 123456789 123456789 123456789 123456789 123456789 123456789           ", System.Text.Encoding.GetEncoding("iso-8859-1")));
            Assert.AreEqual("123456789 123456789 123456789 123456789 123456789 123456789 123456789=\r\n=09=09=09=09=09=09=09=09=09=09=09", qpencoder.EncodeString("123456789 123456789 123456789 123456789 123456789 123456789 123456789											", System.Text.Encoding.GetEncoding("iso-8859-1")));
        }
Пример #3
0
        public void LineLengthTest()
        {
            String line           = "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
            String expectedresult = "1234567890123456789012345678901234567890123456789012345678901234567890123456=\r\n7890";

            QPEncoder     qpencoder = QPEncoder.GetInstance();
            StringReader  sr        = new StringReader(line);
            StringBuilder sb        = new StringBuilder();
            StringWriter  sw        = new StringWriter(sb);

            qpencoder.Encode(sr, sw, System.Text.Encoding.GetEncoding("iso-8859-1"));
            Assert.AreEqual(expectedresult, sb.ToString());

            Assert.AreEqual(expectedresult, qpencoder.EncodeString(line, System.Text.Encoding.GetEncoding("iso-8859-1")));
        }
Пример #4
0
        public void Test256Chars()
        {
            QPEncoder qpencoder = QPEncoder.GetInstance();

            String expected = "=00=01=02=03=04=05=06=07=08=09\r\n" +
                              "=0B=0C\r\n" +
                              "=0E=0F=10=11=12=13=14=15=16=17=18=19=1A=1B=1C=1D=1E=1F !\"#$%&'()*+,-./012345=\r\n" +
                              "6789:;<=3D>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~=\r\n" +
                              "=7F=80=81=82=83=84=85=86=87=88=89=8A=8B=8C=8D=8E=8F=90=91=92=93=94=95=96=97=98=\r\n" +
                              "=99=9A=9B=9C=9D=9E=9F=A0=A1=A2=A3=A4=A5=A6=A7=A8=A9=AA=AB=AC=AD=AE=AF=B0=B1=B2=\r\n" +
                              "=B3=B4=B5=B6=B7=B8=B9=BA=BB=BC=BD=BE=BF=C0=C1=C2=C3=C4=C5=C6=C7=C8=C9=CA=CB=CC=\r\n" +
                              "=CD=CE=CF=D0=D1=D2=D3=D4=D5=D6=D7=D8=D9=DA=DB=DC=DD=DE=DF=E0=E1=E2=E3=E4=E5=E6=\r\n" +
                              "=E7=E8=E9=EA=EB=EC=ED=EE=EF=F0=F1=F2=F3=F4=F5=F6=F7=F8=F9=FA=FB=FC=FD=FE=FF";

            Assert.AreEqual(256, Get256Chars().Length);
            Assert.AreEqual(expected, qpencoder.EncodeString(Get256Chars(), System.Text.Encoding.GetEncoding("iso-8859-1")));
        }