• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.UnitTestUriParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MonoTests.System.UnitTestUriParser的典型用法代码示例。如果您正苦于以下问题:C# UnitTestUriParser类的具体用法?C# UnitTestUriParser怎么用?C# UnitTestUriParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnitTestUriParser类属于MonoTests.System命名空间,在下文中一共展示了UnitTestUriParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Resolve_UriNull

		public void Resolve_UriNull ()
		{
			UriFormatException error = null;
			UnitTestUriParser p = new UnitTestUriParser ();
			Assert.AreEqual (full_http, p._Resolve (http, null, out error), "http-http");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:6,代码来源:UriParserTest.cs


示例2: OnRegister

		public void OnRegister ()
		{
			string scheme = prefix + "onregister";
			Assert.IsFalse (UriParser.IsKnownScheme (scheme), "IsKnownScheme-false");
			UnitTestUriParser p = new UnitTestUriParser ();
			try {
				UriParser.Register (p, scheme, 2005);
			}
			catch (NotSupportedException) {
				// special case / ordering
			}
			// if true then the registration is done before calling OnRegister
			Assert.IsTrue (UriParser.IsKnownScheme (scheme), "IsKnownScheme-true");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:14,代码来源:UriParserTest.cs


示例3: OnRegister2

		public void OnRegister2 ()
		{
			string scheme = prefix + "onregister2";
			Assert.IsFalse (UriParser.IsKnownScheme (scheme), "IsKnownScheme-false");
			UnitTestUriParser p = new UnitTestUriParser ();
			try {
				UriParser.Register (p, scheme, 2005);
				Uri uri = new Uri (scheme + "://foobar:2005");
				Assert.AreEqual (scheme, uri.Scheme, "uri-prefix");
				Assert.AreEqual (2005, uri.Port, "uri-port");
				
				Assert.AreEqual ("//foobar:2005", uri.LocalPath, "uri-localpath");
			}
			catch (NotSupportedException) {
				// special case / ordering
			}
			// if true then the registration is done before calling OnRegister
			Assert.IsTrue (UriParser.IsKnownScheme (scheme), "IsKnownScheme-true");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:19,代码来源:UriParserTest.cs


示例4: Register_TooBigPort

		public void Register_TooBigPort ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			UriParser.Register (p, prefix + "too.big.port", UInt16.MaxValue);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs


示例5: GetComponents_Ftp2

		public void GetComponents_Ftp2 ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			Assert.AreEqual ("ftp", p._GetComponents (ftp2, UriComponents.Scheme, UriFormat.Unescaped), "ftp.Scheme");
			Assert.AreEqual ("username:password", p._GetComponents (ftp2, UriComponents.UserInfo, UriFormat.Unescaped), "ftp.UserInfo");
			Assert.AreEqual ("ftp.go-mono.com", p._GetComponents (ftp2, UriComponents.Host, UriFormat.Unescaped), "ftp.Host");
			Assert.AreEqual (String.Empty, p._GetComponents (ftp2, UriComponents.Port, UriFormat.Unescaped), "ftp.Port");
			Assert.AreEqual ("with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.Path, UriFormat.Unescaped), "ftp.Path");
			Assert.AreEqual ("with%20some%20spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.Path, UriFormat.UriEscaped), "ftp.Path-UriEscaped");
			Assert.AreEqual ("with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.Path, UriFormat.SafeUnescaped), "ftp.Path-SafeUnescaped");
			Assert.AreEqual (String.Empty, p._GetComponents (ftp2, UriComponents.Query, UriFormat.Unescaped), "ftp.Query");
			Assert.AreEqual (String.Empty, p._GetComponents (ftp2, UriComponents.Fragment, UriFormat.Unescaped), "ftp.Fragment");
			Assert.AreEqual ("21", p._GetComponents (ftp2, UriComponents.StrongPort, UriFormat.Unescaped), "ftp.StrongPort");
			Assert.AreEqual (String.Empty, p._GetComponents (ftp2, UriComponents.KeepDelimiter, UriFormat.Unescaped), "http.KeepDelimiter");
			Assert.AreEqual ("ftp.go-mono.com:21", p._GetComponents (ftp2, UriComponents.HostAndPort, UriFormat.Unescaped), "http.HostAndPort");
			Assert.AreEqual ("username:[email protected]:21", p._GetComponents (ftp2, UriComponents.StrongAuthority, UriFormat.Unescaped), "http.StrongAuthority");
			Assert.AreEqual ("ftp://username:[email protected]/with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.AbsoluteUri, UriFormat.Unescaped), "http.AbsoluteUri");
			Assert.AreEqual ("/with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.PathAndQuery, UriFormat.Unescaped), "http.PathAndQuery");
			Assert.AreEqual ("ftp://ftp.go-mono.com/with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.HttpRequestUrl, UriFormat.Unescaped), "http.HttpRequestUrl");
			Assert.AreEqual ("ftp://ftp.go-mono.com", p._GetComponents (ftp2, UriComponents.SchemeAndServer, UriFormat.Unescaped), "http.SchemeAndServer");
			Assert.AreEqual ("ftp://username:[email protected]/with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.SerializationInfoString, UriFormat.Unescaped), "http.SerializationInfoString");
			Assert.AreSame (p, p._OnNewUri (), "OnNewUri");
			// strange mixup
			Assert.AreEqual ("ftp://username:[email protected]", p._GetComponents (ftp2, UriComponents.Scheme | UriComponents.UserInfo, UriFormat.Unescaped), "ftp.Scheme+UserInfo");
			Assert.AreEqual (":21/with some spaces/mono.tgz", p._GetComponents (ftp2, UriComponents.Path | UriComponents.StrongPort, UriFormat.Unescaped), "ftp.Path+StrongPort");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:26,代码来源:UriParserTest.cs


示例6: Register_NullScheme

		public void Register_NullScheme ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			UriParser.Register (p, null, 2006);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs


示例7: Register_Minus1Port

		public void Register_Minus1Port ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			UriParser.Register (p, prefix + "minus1.port", -1);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs


示例8: IsBaseOf

		public void IsBaseOf ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			Assert.IsTrue (p._IsBaseOf (http, http), "http-http");

			Uri u = new Uri ("http://www.mono-project.com/Main_Page#FAQ");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-1a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-1b");

			u = new Uri ("http://www.mono-project.com/Main_Page");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-2a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-2b");

			u = new Uri ("http://www.mono-project.com/");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-3a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-3b");

			u = new Uri ("http://www.mono-project.com/Main_Page/");
			Assert.IsFalse (p._IsBaseOf (u, http), "http-4a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-4b");

			// docs says the UserInfo isn't evaluated, but...
			u = new Uri ("http://username:[email protected]/Main_Page");
			Assert.IsFalse (p._IsBaseOf (u, http), "http-5a");
			Assert.IsFalse (p._IsBaseOf (http, u), "http-5b");

			// scheme case sensitive ? no
			u = new Uri ("HTTP://www.mono-project.com/Main_Page");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-6a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-6b");

			// host case sensitive ? no
			u = new Uri ("http://www.Mono-Project.com/Main_Page");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-7a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-7b");

			// path case sensitive ? no
			u = new Uri ("http://www.Mono-Project.com/MAIN_Page");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-8a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-8b");

			// different scheme
			u = new Uri ("ftp://www.mono-project.com/Main_Page");
			Assert.IsFalse (p._IsBaseOf (u, http), "http-9a");
			Assert.IsFalse (p._IsBaseOf (http, u), "http-9b");

			// different host
			u = new Uri ("http://www.go-mono.com/Main_Page");
			Assert.IsFalse (p._IsBaseOf (u, http), "http-10a");
			Assert.IsFalse (p._IsBaseOf (http, u), "http-10b");

			// different port
			u = new Uri ("http://www.mono-project.com:8080/");
			Assert.IsFalse (p._IsBaseOf (u, http), "http-11a");
			Assert.IsFalse (p._IsBaseOf (http, u), "http-11b");

			// specify default port
			u = new Uri ("http://www.mono-project.com:80/");
			Assert.IsTrue (p._IsBaseOf (u, http), "http-12a");
			Assert.IsTrue (p._IsBaseOf (http, u), "http-12b");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:61,代码来源:UriParserTest.cs


示例9: IsBaseOf_UriNull

		public void IsBaseOf_UriNull ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			p._IsBaseOf (http, null);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs


示例10: InitializeAndValidate

		public void InitializeAndValidate ()
		{
			UriFormatException error = null;
			UnitTestUriParser p = new UnitTestUriParser ();
			p._InitializeAndValidate (http, out error);
			Assert.IsNotNull (error, "out"); // authority/host couldn't be parsed ?!?!
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:UriParserTest.cs


示例11: InitializeAndValidate_Null

		// oh man, this is a bad boy.It should be ArgumentNullException.
		public void InitializeAndValidate_Null ()
		{
			UriFormatException error = null;
			UnitTestUriParser p = new UnitTestUriParser ();
			p._InitializeAndValidate (null, out error);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:UriParserTest.cs


示例12: GetComponents_BadUriFormat

		public void GetComponents_BadUriFormat ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			p._GetComponents (http, UriComponents.Host, (UriFormat) Int32.MinValue);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs


示例13: GetComponents_BadUriComponents

		public void GetComponents_BadUriComponents ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			Assert.AreEqual (full_http, p._GetComponents (http, (UriComponents) Int32.MinValue, UriFormat.SafeUnescaped), "http");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs


示例14: GetComponents_Null

		public void GetComponents_Null ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			p._GetComponents (null, UriComponents.Host, UriFormat.SafeUnescaped);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs


示例15: Resolve_NullUri

		public void Resolve_NullUri ()
		{
			UriFormatException error = null;
			UnitTestUriParser p = new UnitTestUriParser ();
			p._Resolve (null, http, out error);
			p._Resolve (http, null, out error);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:UriParserTest.cs


示例16: IsBaseOf_NullUri

		public void IsBaseOf_NullUri ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			p._IsBaseOf (null, http);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs


示例17: Register

		public void Register ()
		{
			string scheme = prefix + "register.mono";
			Assert.IsFalse (UriParser.IsKnownScheme (scheme), "IsKnownScheme-false");

			UnitTestUriParser p = new UnitTestUriParser ();
			UriParser.Register (p, scheme, 2005);
			Assert.AreEqual (scheme, p.SchemeName, "SchemeName");
			Assert.AreEqual (2005, p.DefaultPort, "DefaultPort");

			Assert.IsTrue (UriParser.IsKnownScheme (scheme), "IsKnownScheme-true");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:12,代码来源:UriParserTest.cs


示例18: IsWellFormedOriginalString

		public void IsWellFormedOriginalString ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			Assert.IsTrue (p._IsWellFormedOriginalString (http), "http");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs


示例19: Register_NegativePort

		public void Register_NegativePort ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			UriParser.Register (p, prefix + "negative.port", -2);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs


示例20: IsWellFormedOriginalString_Null

		public void IsWellFormedOriginalString_Null ()
		{
			UnitTestUriParser p = new UnitTestUriParser ();
			p._IsWellFormedOriginalString (null);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:UriParserTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Common.NonAbstractDBDataPermission类代码示例发布时间:2022-05-26
下一篇:
C# Tasks.TestMessageLogger类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap