public void GetRouteUrl()
        {
            AssertExtensions.Throws <ArgumentNullException> (() => {
                RouteUrlExpressionBuilder.GetRouteUrl(null, "bar=test");
            }, "#A1-1");

            var t = new WebTest(PageInvoker.CreateOnLoad(GetRouteUrl_Load));

            t.Run();
        }
        public static void GetRouteUrl_Load(Page p)
        {
            RouteTable.Routes.Clear();
            RouteTable.Routes.Add(new Route("{foo}-foo", new PageRouteHandler("~/default.aspx")));
            RouteTable.Routes.Add("bar1", new Route("{bar}-foo", new PageRouteHandler("~/bar.aspx")));

            var    ctl = new Control();
            string url = RouteUrlExpressionBuilder.GetRouteUrl(new Control(), "foobar=test");

            Assert.IsNull(url, "#A2");

            url = RouteUrlExpressionBuilder.GetRouteUrl(new Control(), "bar=test");
            Assert.IsNotNull(url, "#A3-1");
            Assert.AreEqual("/NunitWeb/test-foo", url, "#A3-2");

            url = RouteUrlExpressionBuilder.GetRouteUrl(new Control(), "routename=bar1,bar=test");
            Assert.IsNotNull(url, "#A4-1");
            Assert.AreEqual("/NunitWeb/test-foo", url, "#A4-2");

            url = RouteUrlExpressionBuilder.GetRouteUrl(new Control(), "ROUTEname=bar1,bar=test");
            Assert.IsNotNull(url, "#A5-1");
            Assert.AreEqual("/NunitWeb/test-foo", url, "#A5-2");

            url = RouteUrlExpressionBuilder.GetRouteUrl(new Control(), "   routename  =   bar1,    bar  =    test     ");
            Assert.IsNotNull(url, "#A6-1");
            Assert.AreEqual("/NunitWeb/test-foo", url, "#A6-2");

            AssertExtensions.Throws <InvalidOperationException> (() =>
            {
                url = RouteUrlExpressionBuilder.GetRouteUrl(new Control(), "routename");
            }, "#A7-1");

            AssertExtensions.Throws <InvalidOperationException> (() =>
            {
                url = RouteUrlExpressionBuilder.GetRouteUrl(new Control(), String.Empty);
            }, "#A7-2");

            AssertExtensions.Throws <InvalidOperationException> (() =>
            {
                url = RouteUrlExpressionBuilder.GetRouteUrl(new Control(), null);
            }, "#A7-2");
        }