예제 #1
0
        public async Task CaseIgnoreRouting()
        {
            var routes   = new[] { "Tab1", "TAB2", "@-_-@", "+:~", "=%", "Super_Simple+-Route.doc", "1/2", @"1\2/3", "app://tab" };
            var services = Substitute.For <IServiceProvider>();

            foreach (var route in routes)
            {
                var formattedRoute = Routing.FormatRoute(route);
                Routing.RegisterRoute(formattedRoute, typeof(ShellItem));

                var content1 = Routing.GetOrCreateContent(formattedRoute, services);
                Assert.IsNotNull(content1);
                Assert.AreEqual(Routing.GetRoute(content1), formattedRoute);
            }

            Assert.Catch(typeof(ArgumentException), () => Routing.RegisterRoute("app://IMPL_tab21", typeof(ShellItem)));

            Assert.Catch(typeof(ArgumentException), () => Routing.RegisterRoute(@"app:\\IMPL_tab21", typeof(ShellItem)));

            Assert.Catch(typeof(ArgumentException), () => Routing.RegisterRoute(string.Empty, typeof(ShellItem)));

            Assert.Catch(typeof(ArgumentNullException), () => Routing.RegisterRoute(null, typeof(ShellItem)));

            Assert.Catch(typeof(ArgumentException), () => Routing.RegisterRoute("tab1/IMPL_tab11", typeof(ShellItem)));

            Assert.Catch(typeof(ArgumentException), () => Routing.RegisterRoute("IMPL_shell", typeof(ShellItem)));

            Assert.Catch(typeof(ArgumentException), () => Routing.RegisterRoute("app://tab2/IMPL_tab21", typeof(ShellItem)));
        }