示例#1
0
        public void ConvertTestError()
        {
            var currencies = new CurrencyIdentifier[]
            {
                new CurrencyIdentifier
                {
                    Code = "BRL",
                    Name = "Brazilian Real"
                },
                new CurrencyIdentifier
                {
                    Code = "EUR",
                    Name = "Euro"
                }
            };

            var service = new ConvertService(new CurrencyLayerConfiguration(),
                                             new CurrencyService(new CurrencyLayerConfiguration()));
            var result = service.Convert(new ConvertRequest
            {
                Amount = 1,
                From   = currencies[0]
            }).Result;

            Assert.IsNotNull(result);
            Assert.IsFalse(result.Success);
        }
        public void Test1()
        {
            CodeLoader      codeLoader     = new CodeLoader("./", "xLiAdProjectTemplate");
            IConvertService convertService = new ConvertService(codeLoader);
            var             fileItems      = convertService.Convert("SampCorp.Abc");

            Assert.Pass();
        }
示例#3
0
        static void Main(string[] args)
        {
            List <String> lines = new List <string>();

            lines.Add("Identifier,Name,Type,Opened,Currency");
            lines.Add("123|AbcCode,My Account,2,01-01-2018,CD");

            ConvertService service = new ConvertService();
            String         strPath = System.IO.Path.Combine(System.Environment.CurrentDirectory, "Test1.csv");

            service.Convert("SourceAccount1", lines, strPath);
        }
示例#4
0
        /// <summary>
        /// Main method.
        /// </summary>
        public static async Task Main()
        {
            CultureInfo.CurrentCulture = new CultureInfo("en_US");
            // var mode = "generate";
            var mode = "test";

            // var mode = "run";
            if (mode == "generate")
            {
                var generateClass = new GenerateAltinn3ClassesFromJsonSchema();
                await generateClass.Generate();
            }

            if (mode == "test")
            {
                var service         = new ConvertService();
                var targetDirectory = "out";
                if (Directory.Exists(Path.Join(targetDirectory)))
                {
                    Directory.Delete(Path.Join(targetDirectory), recursive: true);
                }

                var a2 = await service.ParseAltinn2File("TULPACKAGE.zip", targetDirectory);

                await service.DumpAltinn2Data(a2, targetDirectory);

                var a3 = await service.Convert(a2);

                await service.DeduplicateTests(a3);

                service.CopyAppTemplate(targetDirectory);
                await service.UpdateAppTemplateFiles(targetDirectory, a3);

                await service.WriteAltinn3Files(a3, targetDirectory);
            }

            if (mode == "run")
            {
                var homeFolder    = System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile);
                var tulFolder     = Path.Join(homeFolder, "TUL");
                var altinn3Folder = Path.Join(homeFolder, "TULtoAltinn3");

                var bs = new BatchService();
                await bs.ConvertAll(tulFolder, altinn3Folder);
            }
        }
示例#5
0
 static int Main(string[] args)
 {
     if (args.Count() < 1)
     {
         Console.WriteLine("USAGE: WordToPDF <source> [destination]");
         return(-1);
     }
     try
     {
         string         inputFile      = (args.Count() > 0) ? args[0] : "c:/users/mterry/git/wordtopdf/src/hello.docx";
         string         outputFile     = (args.Count() > 1) ? args[1] : null;
         ConvertService convertService = new ConvertService();
         convertService.Initialize();
         convertService.Convert(inputFile, ref outputFile);
         return(0);
     }
     catch (Exception e)
     {
         Console.WriteLine($"Failed to generate PDF - {e.Message}");
         return(-1);
     }
 }
示例#6
0
        public async Task <IEnumerable <ITradingInstrument> > CreateDefaultTradingInstruments(string tradingConditionId,
                                                                                              IEnumerable <string> assetPairsIds, DefaultTradingInstrumentSettings defaults)
        {
            var objectsToAdd = assetPairsIds.Select(x => new TradingInstrument
                                                    (
                                                        tradingConditionId,
                                                        x,
                                                        defaults.LeverageInit,
                                                        defaults.LeverageMaintenance,
                                                        defaults.SwapLong,
                                                        defaults.SwapShort,
                                                        defaults.Delta,
                                                        defaults.DealMinLimit,
                                                        defaults.DealMaxLimit,
                                                        defaults.PositionLimit,
                                                        true,
                                                        defaults.LiquidationThreshold,
                                                        defaults.OvernightMarginMultiplier,
                                                        defaults.CommissionRate,
                                                        defaults.CommissionMin,
                                                        defaults.CommissionMax,
                                                        defaults.CommissionCurrency,
                                                        defaults.HedgeCost,
                                                        defaults.Spread
                                                    )).ToList();
            var entitiesToAdd = objectsToAdd.Select(x =>
            {
                var entity = ConvertService.Convert(x, DefaultAzureMappingOpts);
                entity.SetKeys();
                return(entity);
            });

            await TableStorage.InsertAsync(entitiesToAdd);

            return(objectsToAdd);
        }
示例#7
0
        /// <summary>
        /// C#・TypeScript変換
        /// </summary>
        /// <param name="config">設定情報</param>
        /// <param name="outputRepository">出力用リポジトリインスタンス</param>
        /// <param name="inputRepository">入力用リポジトリインスタンス</param>
        public void Convert(Config config, ITSFileRepository outputRepository, ICSFileRepository inputRepository)
        {
            var service = new ConvertService();

            service.Convert(config, outputRepository, inputRepository);
        }