本文整理汇总了C#中MimeKit.Header.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Header.GetValue方法的具体用法?C# Header.GetValue怎么用?C# Header.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MimeKit.Header
的用法示例。
在下文中一共展示了Header.GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestArgumentExceptions
public void TestArgumentExceptions ()
{
var header = new Header ("utf-8", HeaderId.Subject, "This is a subject...");
Assert.Throws<ArgumentOutOfRangeException> (() => new Header (HeaderId.Unknown, "value"));
Assert.Throws<ArgumentNullException> (() => new Header (HeaderId.Subject, null));
Assert.Throws<ArgumentNullException> (() => new Header (null, "value"));
Assert.Throws<ArgumentException> (() => new Header (string.Empty, "value"));
Assert.Throws<ArgumentNullException> (() => new Header ("field", null));
Assert.Throws<ArgumentNullException> (() => new Header ((Encoding) null, HeaderId.Subject, "value"));
Assert.Throws<ArgumentOutOfRangeException> (() => new Header (Encoding.UTF8, HeaderId.Unknown, "value"));
Assert.Throws<ArgumentNullException> (() => new Header (Encoding.UTF8, HeaderId.Subject, null));
Assert.Throws<ArgumentNullException> (() => new Header ((string) null, "field", "value"));
Assert.Throws<ArgumentNullException> (() => new Header ("utf-8", null, "value"));
Assert.Throws<ArgumentException> (() => new Header ("utf-8", string.Empty, "value"));
Assert.Throws<ArgumentNullException> (() => new Header ("utf-8", "field", null));
Assert.Throws<ArgumentNullException> (() => new Header ((Encoding) null, "field", "value"));
Assert.Throws<ArgumentNullException> (() => new Header (Encoding.UTF8, null, "value"));
Assert.Throws<ArgumentException> (() => new Header (Encoding.UTF8, string.Empty, "value"));
Assert.Throws<ArgumentNullException> (() => new Header (Encoding.UTF8, "field", null));
Assert.Throws<ArgumentNullException> (() => new Header ((string) null, HeaderId.Subject, "value"));
Assert.Throws<ArgumentOutOfRangeException> (() => new Header ("utf-8", HeaderId.Unknown, "value"));
Assert.Throws<ArgumentNullException> (() => new Header ("utf-8", HeaderId.Subject, null));
// GetValue
Assert.Throws<ArgumentNullException> (() => header.GetValue ((Encoding) null));
Assert.Throws<ArgumentNullException> (() => header.GetValue ((string) null));
// SetValue
Assert.Throws<ArgumentNullException> (() => header.SetValue (null, Encoding.UTF8, "value"));
Assert.Throws<ArgumentNullException> (() => header.SetValue (FormatOptions.Default, (Encoding) null, "value"));
Assert.Throws<ArgumentNullException> (() => header.SetValue (FormatOptions.Default, Encoding.UTF8, null));
Assert.Throws<ArgumentNullException> (() => header.SetValue (null, "utf-8", "value"));
Assert.Throws<ArgumentNullException> (() => header.SetValue (FormatOptions.Default, (string) null, "value"));
Assert.Throws<ArgumentNullException> (() => header.SetValue (FormatOptions.Default, "utf-8", null));
Assert.Throws<ArgumentNullException> (() => header.SetValue ((Encoding) null, "value"));
Assert.Throws<ArgumentNullException> (() => header.SetValue (Encoding.UTF8, null));
Assert.Throws<ArgumentNullException> (() => header.SetValue ((string) null, "value"));
Assert.Throws<ArgumentNullException> (() => header.SetValue ("utf-8", null));
}