public void BodyContentScraper_should_ignore_non_body_requests_type(IRouteInformation routeInformation)
        {
            // ignore get and delete

            // act
            BodyContentScraper.CompleteBodyRequiredContent(routeInformation, new ControllerActionDescriptor());

            // assert
            Assert.Empty(routeInformation.BodyParams);
        }
        public void BodyContentScraper_should_ignore_methods_without_params()
        {
            // arrange
            var routeInformation = new RouteInformation
            {
                RouteTemplate = "/api/{id}/test/{foo}"
            };

            var description = new ControllerActionDescriptor
            {
                MethodInfo = typeof(FakeController).GetMethod("ParameterLessMethod")
            };

            // act
            BodyContentScraper.CompleteBodyRequiredContent(routeInformation, description);

            // assert
            Assert.Empty(routeInformation.BodyParams);
        }
        public void BodyContentScraper_should_ignore_params_if_they_are_included_as_routing_constraints()
        {
            // arrange
            var routeInformation = new RouteInformation
            {
                RouteTemplate = "/api/{foo}/test",
                HttpMethod    = "POST"
            };

            // this will not run in asp.net core but just to be sure the package support 1 body param
            var description = new ControllerActionDescriptor
            {
                MethodInfo = typeof(FakeController).GetMethod("PostWithDuplicatedRouteAndBodyParam")
            };

            // act
            BodyContentScraper.CompleteBodyRequiredContent(routeInformation, description);

            // assert
            Assert.Empty(routeInformation.BodyParams);
        }
        public void BodyContentScraper_should_consider_params_with_out_from_body_attribute()
        {
            // arrange
            var routeInformation = new RouteInformation
            {
                RouteTemplate = "/api/{id}/test",
                HttpMethod    = "POST"
            };

            // this will not run in asp.net core but just to be sure the package support 1 body param
            var description = new ControllerActionDescriptor
            {
                MethodInfo = typeof(FakeController).GetMethod("PostWithOutFromBody")
            };

            // act
            BodyContentScraper.CompleteBodyRequiredContent(routeInformation, description);

            // assert
            Assert.Single(routeInformation.BodyParams);
            Assert.Equal("foo", routeInformation.BodyParams.First().Key);
            Assert.Equal(typeof(string), routeInformation.BodyParams.First().Value);
        }