public void FormatQuarterTest()
        {
            var quarter1  = CreateQuarter(ticker, period2021Q3, properties, descriptions);
            var quarter2  = CreateQuarter(ticker, period2021Q4, properties, descriptions);
            var csvOutput = TabularFormatter <Quarter> .Format(new List <Quarter> {
                quarter1, quarter2
            });

            var rows = csvOutput.ToRows().ToArray();

            Assert.AreEqual(2, rows.Length);

            var header       = rows[0];
            var firstDataRow = rows[1];

            // check header
            Assert.AreEqual("キー", header.Key);
            Assert.AreEqual("項目名", header.Name);
            Assert.AreEqual("単位", header.Unit);
            Assert.AreEqual(2, header.Values.Count);
            Assert.AreEqual(period2021Q3.ToString(), header.Values[0]);
            Assert.AreEqual(period2021Q4.ToString(), header.Values[1]);

            // check "key" row
            Assert.AreEqual(key, firstDataRow.Key);
            Assert.AreEqual(label, firstDataRow.Name);
            Assert.AreEqual(unit, firstDataRow.Unit);
            Assert.AreEqual(2, firstDataRow.Values.Count);
            Assert.AreEqual(value, firstDataRow.Values[0]);
            Assert.AreEqual(value, firstDataRow.Values[1]);
        }
Exemple #2
0
        public void QuarterTest()
        {
            var quarter      = CreateQuarter(ticker, period, properties, descriptions);
            var csvOutput    = new Tabular <Quarter>();
            var rows         = csvOutput.Add(quarter).ToRows().ToArray();
            var header       = rows[0];
            var firstDataRow = rows[1];

            Assert.AreEqual("キー", header.Key);
            Assert.AreEqual("項目名", header.Name);
            Assert.AreEqual("単位", header.Unit);
            Assert.AreEqual(1, header.Values.Count);
            Assert.AreEqual(period.ToString(), header.Values[0]);

            Assert.AreEqual(key, firstDataRow.Key);
            Assert.AreEqual(label, firstDataRow.Name);
            Assert.AreEqual(unit, firstDataRow.Unit);
            Assert.AreEqual(1, firstDataRow.Values.Count);
            Assert.AreEqual(value, firstDataRow.Values[0]);
        }