示例#1
0
        private string GenerateOutput()
        {
            var solution  = DTETransformer.BuildDteSolution(this.Types.ToArray());
            var generator = new CodeTraverser(solution, this.Settings);
            var data      = generator.GetAllInterfaces().ToList();

            return(OutputFormatter.GetOutput(data, this.Settings));
        }
        public void TestOutputSubClasses()
        {
            var settings = new Settings {
                UseNativeDates = "Date"
            };
            string res = OutputFormatter.GetOutput(GetDataToRenderSubClasses(settings), settings);

            Console.WriteLine(res);
            Assert.AreEqual(ExpectedSubClassesResult, res);
        }
        public void TestInheritedGeneric()
        {
            var settings = new Settings {
                UseNativeDates = "Date", ProcessDataContracts = true
            };
            string res = OutputFormatter.GetOutput(GetInheritedGenericDataToRender(settings), settings);

            Console.WriteLine(res);
            Assert.AreEqual(ExpectedInheritedGenericResult, res);
        }
        public void TestOutputDataContract()
        {
            var settings = new Settings {
                UseNativeDates = "Date"
            };
            var res = OutputFormatter.GetOutput(GetDataToRenderDataContract(settings), settings);

            // Test behaviour by default - no process DataContract classes
            Assert.AreEqual(OutputHeader, res);
            // Test extended behaviour - process DataContract classes
            settings.ProcessDataContracts = true;
            res = OutputFormatter.GetOutput(GetDataToRenderDataContract(settings), settings);
            Console.WriteLine(res);
            Assert.AreEqual(ExpectedDataContractResult, res);
        }
示例#5
0
        private string GenerateOutput()
        {
            var solution         = DTETransformer.BuildDteSolution(this.Types.ToArray());
            var attributeBuilder = new AttributeInterfaceBuilder(this.Settings);
            var typeContext      = new TypeContext(this.TypeSettings);
            var generator        = new CodeTraverser(
                solution,
                typeContext)
            {
                Settings =
                {
                    ClassToInterfaceBuilder = attributeBuilder
                }
            };
            var data = generator.GetAllInterfaces().ToList();

            return(OutputFormatter.GetOutput(
                       data,
                       this.OutputSettings,
                       typeContext));
        }
示例#6
0
        public async Task CompileCommand([Remainder] string code)
        {
            if (!IsCode(code))
            {
                await ReplyAsync(Context.User.Mention + " Start and end your code with \"```\"!");

                return;
            }

            string lang = ParseLanguage(code);

            code = GetCodeToCompile(code);

            if (lang == "")
            {
                await ReplyAsync(Context.User.Mention + " Include what language you're using!");
            }

            OutputFormatter formatter = new OutputFormatter(lang, await _compileService.Compile(code, lang));

            await ReplyAsync(Context.User.Mention + " " + formatter.GetOutput());
        }