public void Should_Build_Uri_Parameters_When_Custom_Scalars()
        {
            var uriParameters = new Dictionary <string, Parameter>
            {
                {
                    "id", new Parameter
                    {
                        DisplayName = "id",
                        Type        = "CustomInt"
                    }
                }
            };

            var methods = new List <Method>
            {
                new Method
                {
                    Verb = "get"
                }
            };

            var resource = new Resource
            {
                RelativeUri   = "/abc{id}",
                Methods       = methods,
                UriParameters = uriParameters
            };

            var schemaObjects = new Dictionary <string, ApiObject>();

            schemaObjects.Add("CustomInt", new ApiObject
            {
                Type       = "CustomInt",
                Name       = "CustomInt",
                Properties = new[] { new Property {
                                         Name = "value", Type = "int"
                                     } }
            });
            var generator           = new UriParametersGenerator(schemaObjects);
            var uriParameterObjects = new Dictionary <string, ApiObject>();
            var generatorMethod     = new ClientGeneratorMethod {
                Name = "MethodOne"
            };

            generator.Generate(resource, "/movies/abc{id}", generatorMethod, uriParameterObjects, new Dictionary <string, Parameter>());

            Assert.AreEqual("CustomInt", generatorMethod.UriParameters.First().Type);
        }
        public void Should_Build_Uri_Parameters()
        {
            var uriParameters = new Dictionary <string, Parameter>
            {
                {
                    "code", new Parameter
                    {
                        DisplayName = "code",
                        Type        = "integer"
                    }
                }
            };

            var methods = new List <Method>
            {
                new Method
                {
                    Verb = "get"
                }
            };

            var resource = new Resource
            {
                RelativeUri   = "/abc{token}{code}",
                Methods       = methods,
                UriParameters = uriParameters
            };

            var generator           = new UriParametersGenerator();
            var uriParameterObjects = new Dictionary <string, ApiObject>();
            var generatorMethod     = new ClientGeneratorMethod {
                Name = "MethodOne"
            };

            generator.Generate(resource, "/movies/{bucket}/abc{token}{code}", generatorMethod, uriParameterObjects, new Dictionary <string, Parameter>());

            Assert.AreEqual(1, uriParameterObjects.Count);
            Assert.AreEqual(3, generatorMethod.UriParameters.Count());
            Assert.AreEqual(uriParameterObjects.First().Value.Name, generatorMethod.UriParametersType);
        }
        public void Should_Build_Uri_Parameters()
        {
            var uriParameters = new Dictionary<string, Parameter>
                                {
                                    {
                                        "code", new Parameter
                                                {
                                                    DisplayName = "code",
                                                    Type = "integer"
                                                }
                                    }
                                };

            var methods = new List<Method>
                          {
                              new Method
                              {
                                  Verb = "get"
                              }
                          };

            var resource = new Resource
                                {
                                    RelativeUri = "/abc{token}{code}",
                                    Methods = methods,
                                    UriParameters = uriParameters
                                };

            var generator = new UriParametersGenerator();
            var uriParameterObjects = new Dictionary<string, ApiObject>();
            var generatorMethod = new ClientGeneratorMethod { Name = "MethodOne"};

            generator.Generate(resource, "/movies/{bucket}/abc{token}{code}", generatorMethod, uriParameterObjects);

            Assert.AreEqual(1, uriParameterObjects.Count);
            Assert.AreEqual(3, generatorMethod.UriParameters.Count());
            Assert.AreEqual(uriParameterObjects.First().Value.Name, generatorMethod.UriParametersType);
        }