public void GetLinkedRoutePatterns(string routeTemplate, string url, string[] exptectedPatterns)
        {
            var configuration = new HttpConfiguration();
            configuration.Routes.MapHttpRoute("test", routeTemplate, new
            {
                id = RouteParameter.Optional,
                chichak = RouteParameter.Optional
            });
            var request = new HttpRequestMessage(HttpMethod.Get, url);
            var routePatternProvider = new ConventionalRoutePatternProvider(configuration);
            var routeData = configuration.Routes.GetRouteData(request);
            request.Properties.Add(HttpPropertyKeys.HttpRouteDataKey, routeData);

            var routePatterns = routePatternProvider.GetLinkedRoutePatterns(request);

            foreach (var exptectedPattern in exptectedPatterns)
            {
                Console.WriteLine(exptectedPattern);

                if (routePatterns.All(x => x != exptectedPattern))
                {
                    Console.WriteLine("These were returned:");
                    routePatterns.ToList().ForEach(x => Console.WriteLine("\t" + x));
                    Assert.Fail("could not find " + exptectedPattern);                           
                }
            }
            
        }
        public void GetRoutePattern_NoRouteData()
        {
            var configuration = GetDefaultConfig();
            var request = new HttpRequestMessage(HttpMethod.Get, "http://google.com/x/y/z?a=b&c=d");
            var routePatternProvider = new ConventionalRoutePatternProvider(configuration);

            Assert.AreEqual("/x/y/z", routePatternProvider.GetRoutePattern(request));
        }
        public void BuildRoutePattern(string routeTemplate, string url, string exptectedPattern)
        {
            // arg
            var configuration = new HttpConfiguration();
            configuration.Routes.MapHttpRoute("test", routeTemplate, new {id = RouteParameter.Optional});
            var request = new HttpRequestMessage(HttpMethod.Get, url);
            var routePatternProvider = new ConventionalRoutePatternProvider(configuration);
            var routeData = configuration.Routes.GetRouteData(request);
            request.Properties.Add(HttpPropertyKeys.HttpRouteDataKey, routeData);

            // act
            var routePattern = routePatternProvider.GetRoutePattern(request);

            // asrt
            Assert.AreEqual(exptectedPattern, routePattern);
        }