AttachmentCollectionTest.cs 920 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // AttachmentCollectionTest.cs - NUnit Test Cases for System.Net.MailAddress.AttachmentCollection
  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 AttachmentCollectionTest
  19. {
  20. AttachmentCollection ac;
  21. Attachment a;
  22. [SetUp]
  23. public void GetReady ()
  24. {
  25. ac = new MailMessage ("[email protected]", "[email protected]").Attachments;
  26. a = Attachment.CreateAttachmentFromString ("test", new ContentType ("text/plain"));
  27. }
  28. [Test]
  29. public void InitialCount ()
  30. {
  31. Assert.IsTrue (ac.Count == 0);
  32. }
  33. [Test]
  34. public void AddCount ()
  35. {
  36. ac.Add (a);
  37. Assert.IsTrue (ac.Count == 1);
  38. }
  39. [Test]
  40. public void RemoveCount ()
  41. {
  42. ac.Remove (a);
  43. Assert.IsTrue (ac.Count == 0);
  44. }
  45. }
  46. }
  47. #endif