Esempio n. 1
0
        public async Task ConvertToStandardFormat()
        {
            var shell = new Shell()
            {
                RouteScheme = "app", Route = "shellroute", RouteHost = "host"
            };

            Uri[] TestUris = new Uri[] {
                CreateUri("path"),
                CreateUri("//path"),
                CreateUri("/path"),
                CreateUri("host/path"),
                CreateUri("//host/path"),
                CreateUri("/host/path"),
                CreateUri("shellroute/path"),
                CreateUri("//shellroute/path"),
                CreateUri("/shellroute/path"),
                CreateUri("host/shellroute/path"),
                CreateUri("//host/shellroute/path"),
                CreateUri("/host/shellroute/path"),
                CreateUri("app://path"),
                CreateUri("app:/path"),
                CreateUri("app://host/path"),
                CreateUri("app:/host/path"),
                CreateUri("app://shellroute/path"),
                CreateUri("app:/shellroute/path"),
                CreateUri("app://host/shellroute/path"),
                CreateUri("app:/host/shellroute/path"),
                CreateUri("app:/host/shellroute\\path")
            };


            foreach (var uri in TestUris)
            {
                Assert.AreEqual(new Uri("app://host/shellroute/path"), ShellUriHandler.ConvertToStandardFormat(shell, uri));

                if (!uri.IsAbsoluteUri)
                {
                    var reverse = new Uri(uri.OriginalString.Replace("/", "\\"), UriKind.Relative);
                    Assert.AreEqual(new Uri("app://host/shellroute/path"), ShellUriHandler.ConvertToStandardFormat(shell, reverse));
                }
            }
        }
Esempio n. 2
0
        public async Task ConvertToStandardFormat()
        {
            var shell = new Shell();

            Uri[] TestUris = new Uri[] {
                CreateUri("path"),
                CreateUri("//path"),
                CreateUri("/path"),
                CreateUri("shell/path"),
                CreateUri("//shell/path"),
                CreateUri("/shell/path"),
                CreateUri("IMPL_shell/path"),
                CreateUri("//IMPL_shell/path"),
                CreateUri("/IMPL_shell/path"),
                CreateUri("shell/IMPL_shell/path"),
                CreateUri("//shell/IMPL_shell/path"),
                CreateUri("/shell/IMPL_shell/path"),
                CreateUri("app://path"),
                CreateUri("app:/path"),
                CreateUri("app://shell/path"),
                CreateUri("app:/shell/path"),
                CreateUri("app://shell/IMPL_shell/path"),
                CreateUri("app:/shell/IMPL_shell/path"),
                CreateUri("app:/shell/IMPL_shell\\path")
            };


            foreach (var uri in TestUris)
            {
                Assert.AreEqual(new Uri("app://shell/IMPL_shell/path"), ShellUriHandler.ConvertToStandardFormat(shell, uri), $"{uri}");

                if (!uri.IsAbsoluteUri)
                {
                    var reverse = new Uri(uri.OriginalString.Replace('/', '\\'), UriKind.Relative);
                    Assert.AreEqual(new Uri("app://shell/IMPL_shell/path"), ShellUriHandler.ConvertToStandardFormat(shell, reverse));
                }
            }
        }