Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MailMessageTest.cs « System.Net.Mail « Test « System « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 30d72633a7591db278c8db55d4af184755eb43d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// MailMessageTest.cs - NUnit Test Cases for System.Net.MailAddress.MailMessage
//
// Authors:
//   John Luke (john.luke@gmail.com)
//
// (C) 2005 John Luke
//
#if NET_2_0
using NUnit.Framework;
using System;
using System.IO;
using System.Text;
using System.Net.Mail;

namespace MonoTests.System.Net.Mail
{
	[TestFixture]
	public class MailMessageTest
	{
		MailMessage msg;
		
		[SetUp]
		public void GetReady ()
		{
			msg = new MailMessage ("from@example.com", "to@example.com");
			msg.Subject = "the subject";
			msg.Body = "hello";
			//msg.AlternateViews.Add (AlternateView.CreateAlternateViewFromString ("<html><body>hello</body></html>", "text/html"));
			//Attachment a = Attachment.CreateAttachmentFromString ("blah blah", "text/plain");
			//msg.Attachments.Add (a);
		}

		/*[Test]
		public void AlternateView ()
		{
			Assert.IsTrue (msg.AlternateViews.Count == 1);
			AlternateView av = msg.AlternateViews[0];
			// test that the type is ok, etc.
		}*/

		/*[Test]
		public void Attachment ()
		{
			Assert.IsTrue (msg.Attachments.Count == 1);
			Attachment at = msg.Attachments[0];
			Assert.IsTrue (at.ContentType.MediaType == "text/plain");
		}*/

		[Test]
		public void Body ()
		{
			Assert.IsTrue (msg.Body == "hello");
		}

		[Test]
		public void From ()
		{
			Assert.IsTrue (msg.From.Address == "from@example.com");
		}

		[Test]
		public void IsBodyHtml ()
		{
			Assert.IsFalse (msg.IsBodyHtml);
		}

		[Test]
		public void Priority ()
		{
			Assert.IsTrue (msg.Priority == MailPriority.Normal);
		}

		[Test]
		public void Subject ()
		{
			Assert.IsTrue (msg.Subject == "the subject");
		}

		[Test]
		public void To ()
		{
			Assert.IsTrue (msg.To.Count == 1);
			Assert.IsTrue (msg.To[0].Address == "to@example.com");
		}
	}
}
#endif