AlternateViewTest.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // AlternateViewTest.cs - NUnit Test Cases for System.Net.MailAddress.AlternateView
  3. //
  4. // Authors:
  5. // John Luke ([email protected])
  6. //
  7. // (C) 2005 John Luke
  8. //
  9. #if NET_2_0
  10. using NUnit.Framework;
  11. using System;
  12. using System.IO;
  13. using System.Net.Mail;
  14. using System.Net.Mime;
  15. namespace MonoTests.System.Net.Mail
  16. {
  17. [TestFixture]
  18. public class AlternateViewTest
  19. {
  20. AlternateView av;
  21. [SetUp]
  22. public void GetReady ()
  23. {
  24. av = AlternateView.CreateAlternateViewFromString ("test", new ContentType ("text/plain"));
  25. }
  26. [Test]
  27. [ExpectedException (typeof (ArgumentNullException))]
  28. public void ArgumentNullException ()
  29. {
  30. string s = null;
  31. new AlternateView (s);
  32. }
  33. [Test]
  34. [ExpectedException (typeof (ArgumentNullException))]
  35. public void ArgumentNullException2 ()
  36. {
  37. Stream s = null;
  38. new AlternateView (s);
  39. }
  40. [Test]
  41. public void ContentType ()
  42. {
  43. Assert.IsNotNull (av.ContentType);
  44. Assert.IsTrue (av.ContentType.MediaType == "text/plain");
  45. }
  46. [Test]
  47. public void ContentStream ()
  48. {
  49. Assert.IsNotNull (av.ContentStream);
  50. Assert.IsTrue (av.ContentStream.Length == 4);
  51. }
  52. [Test]
  53. public void TransferEncoding ()
  54. {
  55. //Assert.IsTrue (av.TransferEncoding = TransferEncoding.QuotedPrintable);
  56. }
  57. }
  58. }
  59. #endif