Ejemplo n.º 1
0
        public void TestParameterizedCtor()
        {
            const string expected = "Content-Type: text/plain\nContent-Transfer-Encoding: base64\nContent-Id: <*****@*****.**>\n\n\n";
            var          headers  = new [] { new Header("Content-Id", "<*****@*****.**>") };
            var          part     = new MimePart("text", "plain", new Header("Content-Transfer-Encoding", "base64"), headers)
            {
                Content = new MimeContent(new MemoryStream())
            };

            Assert.AreEqual("*****@*****.**", part.ContentId, "Content-Id");
            Assert.AreEqual(ContentEncoding.Base64, part.ContentTransferEncoding, "Content-Transfer-Encoding");
            Assert.AreEqual(expected, part.ToString().Replace("\r\n", "\n"), "ToString");
        }
Ejemplo n.º 2
0
        public void TestToString()
        {
            var part = new MimePart("application", "octet-stream")
            {
                ContentTransferEncoding = ContentEncoding.Base64,
                Content = new MimeContent(new MemoryStream(new byte[1], false))
            };

            try {
                part.ToString();
            } catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }