System.PrivateUri.Tests.UriParserTest.OnRegister2 C# (CSharp) Méthode

OnRegister2() private méthode

private OnRegister2 ( ) : void
Résultat void
        public static void OnRegister2()
        {
            prefix = "unit.test.";
            string scheme = prefix + "onregister2";
            Assert.False(UriParser.IsKnownScheme(scheme), "IsKnownScheme-false");
            TestUriParser parser = new TestUriParser();
            try
            {
                UriParser.Register(parser, scheme, 2005);
                Uri uri = new Uri(scheme + "://foobar:2005");
                Assert.Equal(scheme, uri.Scheme);
                Assert.Equal(2005, uri.Port);
                Assert.Equal("//foobar:2005", uri.LocalPath);
            }
            catch (NotSupportedException)
            {
                // special case / ordering
            }
            // if true then the registration is done before calling OnRegister
            Assert.True(UriParser.IsKnownScheme(scheme), "IsKnownScheme-true");
        }