Beispiel #1
0
 private static Quarter CreateQuarter(string ticker, FiscalQuarterPeriod period, IDictionary <string, string> properties, IDictionary <string, PropertyDescription> descriptions)
 {
     return(Quarter.Create(
                ticker,
                period,
                properties is null ? PropertyDictionary.Empty() : new PropertyDictionary(properties),
                descriptions is null ? PropertyDescriptionDictionary.Empty() : new PropertyDescriptionDictionary(descriptions)
                ));
 }
        private static Quarter ParseQuarter(
            PropertyDictionary properties,
            PropertyDescriptionDictionary descriptions)
        {
            var fiscalYear    = Convert.ToUInt16(properties.Get(PropertyNames.FiscalYear));
            var fiscalQuarter = Convert.ToUInt16(properties.Get(PropertyNames.FiscalQuarter));

            return(Quarter.Create(
                       properties.Get(PropertyNames.Ticker),
                       fiscalYear,
                       fiscalQuarter,
                       properties,
                       descriptions
                       ));
        }
        public void SelectFormattedValueTest()
        {
            var quarter = Quarter.Create(
                ticker,
                period,
                new PropertyDictionary(properties),
                new PropertyDescriptionDictionary(descriptions)
                );

            // select ceo_name
            Assert.AreEqual("Mr. CEO", PropertySelector.SelectFormattedValue("ceo_name", quarter, false, false, false));
            Assert.AreEqual("Mr. CEO", PropertySelector.SelectFormattedValue("ceo_name", quarter, true, false, false));
            Assert.AreEqual("Mr. CEO", PropertySelector.SelectFormattedValue("ceo_name", quarter, false, true, false));
            Assert.AreEqual("Mr. CEO", PropertySelector.SelectFormattedValue("ceo_name", quarter, false, false, true));

            // select net_sales
            Assert.AreEqual("1,000,000,000", PropertySelector.SelectFormattedValue("net_sales", quarter, false, false, false));
            Assert.AreEqual("1000000000", PropertySelector.SelectFormattedValue("net_sales", quarter, true, false, false));
            Assert.AreEqual("1,000", PropertySelector.SelectFormattedValue("net_sales", quarter, false, false, true));
            Assert.AreEqual("1,000,000,000円", PropertySelector.SelectFormattedValue("net_sales", quarter, false, true, false));
            Assert.AreEqual("1000000000円", PropertySelector.SelectFormattedValue("net_sales", quarter, true, true, false));
            Assert.AreEqual("1,000百万円", PropertySelector.SelectFormattedValue("net_sales", quarter, false, true, true));
        }