2
0

MailAddressTest.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // MailAddressTest.cs - NUnit Test Cases for System.Net.MailAddress.MailAddress
  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.Net.Mail;
  13. namespace MonoTests.System.Net.Mail
  14. {
  15. [TestFixture]
  16. public class MailAddressTest
  17. {
  18. MailAddress address;
  19. [SetUp]
  20. public void GetReady ()
  21. {
  22. address = new MailAddress ("[email protected]", "Mr. Foo Bar");
  23. }
  24. [Test]
  25. public void Address ()
  26. {
  27. Assert.IsTrue (address.Address == "[email protected]");
  28. }
  29. [Test]
  30. public void DisplayName ()
  31. {
  32. Assert.IsTrue (address.DisplayName == "Mr. Foo Bar");
  33. }
  34. [Test]
  35. public void User ()
  36. {
  37. Assert.IsTrue (address.User == "foo");
  38. }
  39. [Test]
  40. public void Host ()
  41. {
  42. Assert.IsTrue (address.Host == "example.com");
  43. }
  44. [Test]
  45. public void SimpleToStringTest ()
  46. {
  47. Assert.IsTrue (new MailAddress ("[email protected]").ToString () == "[email protected]");
  48. }
  49. [Test]
  50. public void ToStringTest ()
  51. {
  52. Assert.IsTrue (address.ToString () == "\"Mr. Foo Bar\" <[email protected]>");
  53. }
  54. }
  55. }
  56. #endif