本文整理汇总了C#中Mail.AddCc方法的典型用法代码示例。如果您正苦于以下问题:C# Mail.AddCc方法的具体用法?C# Mail.AddCc怎么用?C# Mail.AddCc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail.AddCc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAddCc
public void TestAddCc()
{
var foo = new Mock<IHeader>();
var sg = new Mail(foo.Object);
sg.AddCc("[email protected]");
Assert.AreEqual("[email protected]", sg.Cc.First().ToString(), "Single CC Address");
sg = new Mail(foo.Object);
var strings = new String[2];
strings[0] = "[email protected]";
strings[1] = "[email protected]";
sg.AddCc(strings);
Assert.AreEqual("[email protected]", sg.Cc[0].ToString(), "Multiple CC addresses, check first one");
Assert.AreEqual("[email protected]", sg.Cc[1].ToString(), "Multiple CC addresses, check second one");
sg = new Mail(foo.Object);
var a = new Dictionary<String, String>();
a.Add("DisplayName", "Eric");
var datastruct = new Dictionary<string, IDictionary<string, string>> { { "[email protected]", a } };
sg.AddCc(datastruct);
Assert.AreEqual("Eric", sg.Cc.First().DisplayName, "Single CC address with args");
}
示例2: TestGetRcpts
public void TestGetRcpts()
{
var foo = new Mock<IHeader>();
var sg = new Mail(foo.Object);
sg.AddTo("[email protected]");
sg.AddCc("[email protected]");
sg.AddBcc("[email protected]");
sg.AddBcc("[email protected]");
var rcpts = sg.GetRecipients();
Assert.AreEqual("[email protected]", rcpts.First(), "getRecipients check To");
Assert.AreEqual("[email protected]", rcpts.Skip(1).First(), "getRecipients check Cc");
Assert.AreEqual("[email protected]", rcpts.Skip(2).First(), "getRecipients check Bcc");
Assert.AreEqual("[email protected]", rcpts.Skip(3).First(), "getRecipients check Bcc x2");
}