public void GetUrl_WithoutAllRequiredValues_GeneratesUrl()
        {
            // Arrange
            var template = new RoutePatternTemplate(BinderFactory.Create("api/products/{id}"));

            // Act
            var url = template.GetUrl(new DispatcherValueCollection(new { name = "billy" }));

            // Assert
            Assert.Null(url);
        }
        public void GetUrl_WithAllRequiredValues_GeneratesUrl()
        {
            // Arrange
            var template = new RoutePatternTemplate(BinderFactory.Create("api/products/{id}"));

            // Act
            var url = template.GetUrl(new DispatcherValueCollection(new { id = 17 }));

            // Assert
            Assert.Equal("/api/products/17", url);
        }
        public void GetUrl_WithAmbientValues_GeneratesUrl()
        {
            // Arrange
            var template = new RoutePatternTemplate(BinderFactory.Create("api/products/{id}/{name}"));

            var httpContext = new DefaultHttpContext();

            httpContext.Features.Set <IDispatcherFeature>(new DispatcherFeature()
            {
                Values = new DispatcherValueCollection(new { id = 17 }),
            });

            // Act
            var url = template.GetUrl(httpContext, new DispatcherValueCollection(new { name = "billy" }));

            // Assert
            Assert.Equal("/api/products/17/billy", url);
        }