/// <summary>
        /// Loads a trade report template from the standard INI format.
        /// </summary>
        /// <param name="templateName">  the name of the template </param>
        /// <returns> the loaded report template </returns>
        public static TradeReportTemplate loadTradeReportTemplate(string templateName)
        {
            string          resourceName    = string.format(Locale.ENGLISH, "classpath:example-reports/%s.ini", templateName);
            ResourceLocator resourceLocator = ResourceLocator.of(resourceName);
            IniFile         ini             = IniFile.of(resourceLocator.CharSource);

            return(TradeReportTemplate.load(ini));
        }
示例#2
0
        private TradeReportTemplate parseIni(string resourceName)
        {
            ResourceLocator locator             = ResourceLocator.of("classpath:" + resourceName);
            IniFile         ini                 = IniFile.of(locator.CharSource);
            TradeReportTemplateIniLoader loader = new TradeReportTemplateIniLoader();

            return(loader.load(ini));
        }
        //-------------------------------------------------------------------------
        /// <summary>
        /// Loads a golden copy of expected results from a text file.
        /// </summary>
        /// <param name="name">  the name of the results </param>
        /// <returns> the loaded results </returns>
        public static string loadExpectedResults(string name)
        {
            string          classpathResourceName = string.format(Locale.ENGLISH, "classpath:goldencopy/%s.txt", name);
            ResourceLocator resourceLocator       = ResourceLocator.of(classpathResourceName);

            try
            {
                return(resourceLocator.CharSource.read().Trim());
            }
            catch (IOException ex)
            {
                throw new UncheckedIOException(name, ex);
            }
        }