SmtpClientTest.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // SmtpClientTest.cs - NUnit Test Cases for System.Net.Mail.SmtpClient
  3. //
  4. // Authors:
  5. // John Luke ([email protected])
  6. //
  7. // (C) 2006 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 SmtpClientTest
  19. {
  20. SmtpClient smtp;
  21. [SetUp]
  22. public void GetReady ()
  23. {
  24. smtp = new SmtpClient ();
  25. }
  26. [Test]
  27. public void InitialTimeout ()
  28. {
  29. Assert.AreEqual (smtp.Timeout, 100000);
  30. }
  31. [Test]
  32. [ExpectedException (typeof (ArgumentOutOfRangeException))]
  33. public void NegativePortValue ()
  34. {
  35. smtp.Port = -1;
  36. }
  37. [Test]
  38. [ExpectedException (typeof (ArgumentOutOfRangeException))]
  39. public void NegativeTimeoutValue ()
  40. {
  41. smtp.Timeout = -1;
  42. }
  43. [Test]
  44. [ExpectedException (typeof (ArgumentNullException))]
  45. public void NullHost ()
  46. {
  47. smtp.Host = null;
  48. }
  49. [Test]
  50. [ExpectedException (typeof (ArgumentException))]
  51. public void EmptyHost ()
  52. {
  53. smtp.Host = String.Empty;
  54. }
  55. }
  56. }
  57. #endif