[corlib] Improve CancellationTokenSource test
[mono.git] / mcs / class / System / Test / System.Net.Mail / AlternateViewTest.cs
index 9cfd90cfff78ca1338f1a16287b3c4419b70ed56..64e6efa61be1eb468986264393636d8ee953ffcd 100644 (file)
@@ -6,7 +6,6 @@
 //
 // (C) 2005 John Luke
 //
-#if NET_2_0
 using NUnit.Framework;
 using System;
 using System.IO;
@@ -49,6 +48,14 @@ namespace MonoTests.System.Net.Mail
                        Assert.IsTrue (av.ContentType.MediaType == "text/plain");
                }
 
+               [Test]
+               public void ContentType2 ()
+               {
+                       AlternateView av = new AlternateView (new MemoryStream ());
+                       Assert.IsNotNull (av.ContentType, "#1");
+                       Assert.AreEqual ("application/octet-stream", av.ContentType.MediaType, "#2");
+               }
+
                [Test]
                public void ContentStream ()
                {
@@ -57,10 +64,19 @@ namespace MonoTests.System.Net.Mail
                }
 
                [Test]
-               public void TransferEncoding ()
+               public void TransferEncodingTest ()
+               {
+                       Assert.AreEqual (TransferEncoding.QuotedPrintable, av.TransferEncoding, "#1");
+
+                       MemoryStream ms = new MemoryStream (new byte [] {1, 2, 3});
+                       Assert.AreEqual (TransferEncoding.Base64, new AlternateView (ms).TransferEncoding, "#2");
+                       Assert.AreEqual (TransferEncoding.Base64, new AlternateView (ms, "text/plain").TransferEncoding, "#3");
+               }
+
+               [Test]
+               public void CreateAlternateViewFromStringEncodingNull ()
                {
-                       //Assert.IsTrue (av.TransferEncoding = TransferEncoding.QuotedPrintable);
+                       AlternateView.CreateAlternateViewFromString ("<p>test message</p>", null, "text/html");
                }
        }
 }
-#endif