当前位置: 首页>>代码示例>>C#>>正文


C# ContentType.ToString方法代码示例

本文整理汇总了C#中MimeKit.ContentType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ContentType.ToString方法的具体用法?C# ContentType.ToString怎么用?C# ContentType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MimeKit.ContentType的用法示例。


在下文中一共展示了ContentType.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestBreakingOfLongParamValues

        public void TestBreakingOfLongParamValues()
        {
            string encoded, expected;
            ContentType type;

            expected = "Content-Type: text/plain; charset=iso-8859-1;\n\tname*0=\"this is a really really long filename that should force MimeKi\";\n\tname*1=\"t to break it apart - yay!.html\"";
            type = new ContentType ("text", "plain");
            type.Parameters.Add ("charset", "iso-8859-1");
            type.Parameters.Add ("name", "this is a really really long filename that should force MimeKit to break it apart - yay!.html");
            encoded = type.ToString (Encoding.UTF8, true);
            Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
        }
开发者ID:vdaron,项目名称:MimeKit,代码行数:12,代码来源:ContentTypeTests.cs

示例2: TestEncodingOfLongParamValues

        public void TestEncodingOfLongParamValues()
        {
            string encoded, expected;
            ContentType type;

            expected = "Content-Type: text/plain; charset=utf-8;\n\tname*0*=iso-8859-1''%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5;\n\tname*1*=%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5;\n\tname*2*=%E5%E5%E5%E5";
            type = new ContentType ("text", "plain");
            type.Parameters.Add ("charset", "utf-8");
            type.Parameters.Add ("name", new string ('å', 40));
            encoded = type.ToString (Encoding.UTF8, true);
            Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
        }
开发者ID:vdaron,项目名称:MimeKit,代码行数:12,代码来源:ContentTypeTests.cs

示例3: TestEncodingOfParamValues

        public void TestEncodingOfParamValues()
        {
            string encoded, expected;
            ContentType type;

            expected = "Content-Type: text/plain; charset=iso-8859-1;\n\tname*=iso-8859-1''Kristoffer%20Br%E5nemyr";
            type = new ContentType ("text", "plain");
            type.Parameters.Add ("charset", "iso-8859-1");
            type.Parameters.Add ("name", "Kristoffer Brånemyr");
            encoded = type.ToString (Encoding.UTF8, true);
            Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
        }
开发者ID:vdaron,项目名称:MimeKit,代码行数:12,代码来源:ContentTypeTests.cs

示例4: TestEncodingOfLongParamValues

		public void TestEncodingOfLongParamValues ()
		{
			string expected = "Content-Type: text/plain; charset=utf-8;\n\tname*0*=iso-8859-1''%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5;\n\tname*1*=%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5";

			if (FormatOptions.Default.NewLineFormat != NewLineFormat.Unix)
				expected = expected.Replace ("\n", "\r\n");

			var type = new ContentType ("text", "plain");
			type.Parameters.Add ("charset", "utf-8");
			type.Parameters.Add ("name", new string ('å', 40));

			var encoded = type.ToString (Encoding.UTF8, true);

			Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
		}
开发者ID:ruffin--,项目名称:MimeKit,代码行数:15,代码来源:ContentTypeTests.cs

示例5: TestEncodingOfParamValues

		public void TestEncodingOfParamValues ()
		{
			string expected = "Content-Type: text/plain; charset=iso-8859-1;\n\tname*=iso-8859-1''Kristoffer%20Br%E5nemyr";

			if (FormatOptions.Default.NewLineFormat != NewLineFormat.Unix)
				expected = expected.Replace ("\n", "\r\n");

			var type = new ContentType ("text", "plain");
			type.Parameters.Add ("charset", "iso-8859-1");
			type.Parameters.Add ("name", "Kristoffer Brånemyr");

			var encoded = type.ToString (Encoding.UTF8, true);

			Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
		}
开发者ID:ruffin--,项目名称:MimeKit,代码行数:15,代码来源:ContentTypeTests.cs

示例6: TestBreakingOfLongParamValues

		public void TestBreakingOfLongParamValues ()
		{
			string expected = "Content-Type: text/plain; charset=iso-8859-1;\n\tname*0=\"this is a really really long filename that should force MimeKit to b\";\n\tname*1=\"reak it apart - yay!.html\"";

			if (FormatOptions.Default.NewLineFormat != NewLineFormat.Unix)
				expected = expected.Replace ("\n", "\r\n");

			var type = new ContentType ("text", "plain");
			type.Parameters.Add ("charset", "iso-8859-1");
			type.Parameters.Add ("name", "this is a really really long filename that should force MimeKit to break it apart - yay!.html");

			var encoded = type.ToString (Encoding.UTF8, true);

			Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
		}
开发者ID:ruffin--,项目名称:MimeKit,代码行数:15,代码来源:ContentTypeTests.cs


注:本文中的MimeKit.ContentType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。