Exemplo n.º 1
0
        public PluginCsa()
        {
            Context = new DependencyInjection.Context
            {
                // inherit base settings
                Context,

                // set code model implementations our own implementations
                new Factory <CodeModel, CodeModelCsa>(),
                new Factory <CompositeType, CompositeTypeCsa>(),
                new Factory <DictionaryType, DictionaryTypeCs>(),
                new Factory <EnumType, EnumTypeCs>(),
                new Factory <Method, MethodCsa>(),
                new Factory <MethodGroup, MethodGroupCsa>(),
                new Factory <Parameter, ParameterCsa>(),
                new Factory <PrimaryType, PrimaryTypeCsa>(),
                new Factory <Property, PropertyCs>(),
                new Factory <SequenceType, SequenceTypeCs>(),

                // we have a specific constructor for when a literal type is necessary.
                new Factory <ILiteralType> {
                    (string name) => new CompositeTypeCsa {
                        Name = { FixedValue = name }
                    }
                },
            };
        }
Exemplo n.º 2
0
        public void PassingTest()
        {
            var workingDir = Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\Resource");
            var inputFile  = Path.Combine(workingDir, "test1-tags.json");

            using (var context = new DependencyInjection.Context().Activate())
            {
                var settings = new Settings
                {
                    Input           = inputFile,
                    OutputDirectory = workingDir,
                    CodeGenerator   = "Test"
                };

                var modeler   = new SwaggerModeler();
                var codeModel = modeler.Build();
                var plugin    = new PluginTs();

                using (plugin.Activate())
                {
                    codeModel = plugin.Serializer.Load(codeModel);
                    codeModel = plugin.Transformer.TransformCodeModel(codeModel);

                    //settings.CodeGenerator = "";

                    Core.AutoRestController.Generate();
                }
            }
        }
Exemplo n.º 3
0
        public void PassingTest()
        {
            Func <string, string> parent = path => Directory.GetParent(path).FullName;
            var currentPath = Directory.GetCurrentDirectory();

            Console.WriteLine("Starting PassingTest");

            using (var context = new DependencyInjection.Context().Activate())
            {
                var path = "";

                try
                {
                    parent(parent(parent(currentPath)));
                }
                catch (NullReferenceException)
                {
                    path = "C:\\DevWorkspace\\git\\autorest\\src\\generator\\AutoRest.CSharp.LoadBalanced.Tests";
                }

                var settings = new Settings
                {
                    Input           = "C:\\swagger\\temp\\temp.json.txt",
                    OutputDirectory = "C:\\swagger\\output\\_test",
                    CodeGenerator   = "Test",
                    Namespace       = "Agoda.SupplyApi.Client"
                };

                var modeler   = new SwaggerModeler();
                var codeModel = modeler.Build();
                var plugin    = new LoadBalancedLegacyPluginCs();

                using (plugin.Activate())
                {
                    codeModel = plugin.Serializer.Load(codeModel);
                    codeModel = plugin.Transformer.TransformCodeModel(codeModel);

                    //settings.CodeGenerator = "";

                    Core.AutoRestController.Generate();
                }
            }
        }
Exemplo n.º 4
0
        public void PassingTest()
        {
            Func <string, string> parent = path => Directory.GetParent(path).FullName;
            var currentPath = Directory.GetCurrentDirectory();

            using (var context = new DependencyInjection.Context().Activate())
            {
                var path = "";

                try
                {
                    parent(parent(parent(currentPath)));
                }
                catch (NullReferenceException)
                {
                    path = "C:\\projects\\autorest\\src\\generator\\AutoRest.CSharp.LoadBalanced.Tests";
                }

                var settings = new Settings
                {
                    Input           = "http://petstore.swagger.io/v2/swagger.json",
                    OutputDirectory = "D:\\projects\\gen2",
                    CodeGenerator   = "Test",
                    Namespace       = "Agoda.SAPI.Client"
                };

                var modeler   = new SwaggerModeler();
                var codeModel = modeler.Build();
                var plugin    = new LoadBalancedPluginCs();

                using (plugin.Activate())
                {
                    codeModel = plugin.Serializer.Load(codeModel);
                    codeModel = plugin.Transformer.TransformCodeModel(codeModel);

                    //settings.CodeGenerator = "";

                    Core.AutoRestController.Generate();
                }
            }
        }