2 // AlternateViewTest.cs - NUnit Test Cases for System.Net.MailAddress.AlternateView
5 // John Luke (john.luke@gmail.com)
10 using NUnit.Framework;
13 using System.Net.Mail;
14 using System.Net.Mime;
16 namespace MonoTests.System.Net.Mail
19 public class AlternateViewTest
24 public void GetReady ()
26 av = AlternateView.CreateAlternateViewFromString ("test", new ContentType ("text/plain"));
30 [ExpectedException (typeof (ArgumentNullException))]
31 public void ArgumentNullException ()
34 new AlternateView (s);
38 [ExpectedException (typeof (ArgumentNullException))]
39 public void ArgumentNullException2 ()
42 new AlternateView (s);
46 public void ContentType ()
48 Assert.IsNotNull (av.ContentType);
49 Assert.IsTrue (av.ContentType.MediaType == "text/plain");
53 public void ContentType2 ()
55 AlternateView av = new AlternateView (new MemoryStream ());
56 Assert.IsNotNull (av.ContentType, "#1");
57 Assert.AreEqual ("application/octet-stream", av.ContentType.MediaType, "#2");
61 public void ContentStream ()
63 Assert.IsNotNull (av.ContentStream);
64 Assert.IsTrue (av.ContentStream.Length == 4);
68 public void TransferEncodingTest ()
70 Assert.AreEqual (TransferEncoding.QuotedPrintable, av.TransferEncoding, "#1");
72 MemoryStream ms = new MemoryStream (new byte [] {1, 2, 3});
73 Assert.AreEqual (TransferEncoding.Base64, new AlternateView (ms).TransferEncoding, "#2");
74 Assert.AreEqual (TransferEncoding.Base64, new AlternateView (ms, "text/plain").TransferEncoding, "#3");