AttachmentTest.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // AttachmentTest.cs - NUnit Test Cases for System.Net.MailAddress.Attachment
  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.Text;
  14. using System.Net.Mail;
  15. namespace MonoTests.System.Net.Mail
  16. {
  17. [TestFixture]
  18. public class AttachmentTest
  19. {
  20. Attachment attach;
  21. [SetUp]
  22. public void GetReady ()
  23. {
  24. attach = Attachment.CreateAttachmentFromString ("test", "text/plain");
  25. }
  26. [Test]
  27. [ExpectedException (typeof (ArgumentNullException))]
  28. public void ArgumentNullException ()
  29. {
  30. Stream s = null;
  31. new Attachment (s, "application/octet-stream");
  32. }
  33. [Test]
  34. public void ContentDisposition ()
  35. {
  36. Assert.IsNotNull (attach.ContentDisposition);
  37. Assert.IsTrue (attach.ContentDisposition.DispositionType == "attachment");
  38. }
  39. [Test]
  40. public void ContentType ()
  41. {
  42. Assert.IsNotNull (attach.ContentType);
  43. Assert.IsTrue (attach.ContentType.MediaType == "text/plain");
  44. }
  45. [Test]
  46. public void NameEncoding ()
  47. {
  48. Assert.IsNull (attach.NameEncoding);
  49. }
  50. [Test]
  51. public void ContentStream ()
  52. {
  53. Assert.IsNotNull (attach.ContentStream);
  54. Assert.IsTrue (attach.ContentStream.Length == 4);
  55. }
  56. /*[Test]
  57. public void Name ()
  58. {
  59. Assert.IsNotNull (attach.Name);
  60. }
  61. [Test]
  62. public void TransferEncoding ()
  63. {
  64. Assert.IsTrue (attach.TransferEncoding == MimeTransferEncoding.Base64);
  65. }*/
  66. }
  67. }
  68. #endif