Example #1
0
        public void should_parse_query_object()
        {
            var parameterDynamicRaml = new Dictionary <string, object>
            {
                { "type", "string" },
                { "displayName", "ParameterName" },
                { "description", "this is the description" }
            };

            var parameters = new Dictionary <string, object> {
                { "one", parameterDynamicRaml }
            };

            var dynamicRaml = new Dictionary <string, object> {
                { "method", "get" }, { "queryParameters", parameters }
            };

            var generatedMethod = new ClientGeneratorMethod {
                Name = "GeneratedMethod"
            };
            const string objectName       = "ObjName";
            var          queryObj         = QueryParametersParser.GetQueryObject(generatedMethod, new MethodBuilder().Build(dynamicRaml), objectName);
            var          parsedParameters = queryObj.Properties;

            Assert.AreEqual(generatedMethod.Name + objectName + "Query", queryObj.Name);
            Assert.AreEqual(1, parsedParameters.Count);
            Assert.AreEqual("string", parsedParameters.First().Type);
            Assert.AreEqual("One", parsedParameters.First().Name);
        }
Example #2
0
 private void GetQueryParameters(string objectName, Method method, ClientGeneratorMethod generatedMethod)
 {
     if (method.QueryParameters != null && method.QueryParameters.Any())
     {
         var queryObject = queryParametersParser.GetQueryObject(generatedMethod, method, objectName);
         generatedMethod.Query = queryObject;
         if (!queryObjects.ContainsKey(queryObject.Name))
         {
             queryObjects.Add(queryObject.Name, queryObject);
         }
     }
 }