コード例 #1
0
        public void TestContentTypeCharsetWithLargeFirstChar()
        {
            const string messagePartContent =
                "Content-Type: TEXT/PLAIN; Charset=\"US-ASCII\"\r\n" +
                "\r\n" +                 // End of message headers
                "foo";

            MessagePart messagePart = new OPMessage(Encoding.ASCII.GetBytes(messagePartContent)).MessagePart;

            Assert.AreEqual(Encoding.ASCII, messagePart.BodyEncoding);
            Assert.AreEqual("foo", messagePart.GetBodyAsText());
        }
コード例 #2
0
        public void TestQuotedPrintableDoesNotDecodeUnderscoresInBody()
        {
            const string messagePartContent =
                "Content-Transfer-Encoding: quoted-printable\r\n" +
                "\r\n" +                 // End of message headers
                "a_a";

            MessagePart messagePart = new OPMessage(Encoding.ASCII.GetBytes(messagePartContent)).MessagePart;

            // QuotedPrintable, when used as Content-Transfer-Encoding does not decode _ to spaces
            const string expectedBody = "a_a";
            string       actualBody   = messagePart.GetBodyAsText();

            Assert.AreEqual(expectedBody, actualBody);
        }