public void AddRouteDataToRequest_DoesNotAddRequestProperty_WhenRouteDataNull()
        {
            var mockRouteData = new Mock <IHttpRouteData>(MockBehavior.Strict);
            IDictionary <string, object> values = null;

            mockRouteData.Setup(p => p.Values).Returns(values);
            HttpRequestMessage request = new HttpRequestMessage();

            WebScriptHostManager.AddRouteDataToRequest(mockRouteData.Object, request);

            Assert.False(request.Properties.ContainsKey(HttpExtensionConstants.AzureWebJobsHttpRouteDataKey));
        }
        public void AddRouteDataToRequest_AddsRequestProperty_WhenRouteDataNotNull()
        {
            var mockRouteData = new Mock <IHttpRouteData>(MockBehavior.Strict);
            IDictionary <string, object> values = new Dictionary <string, object>
            {
                { "p1", "abc" },
                { "p2", 123 },
                { "p3", null },
                { "p4", RouteParameter.Optional }
            };

            mockRouteData.Setup(p => p.Values).Returns(values);
            HttpRequestMessage request = new HttpRequestMessage();

            WebScriptHostManager.AddRouteDataToRequest(mockRouteData.Object, request);

            var result = (IDictionary <string, object>)request.Properties[HttpExtensionConstants.AzureWebJobsHttpRouteDataKey];

            Assert.Equal(result["p1"], "abc");
            Assert.Equal(result["p2"], 123);
            Assert.Equal(result["p3"], null);
            Assert.Equal(result["p4"], null);
        }