Example #1
0
        TestAppendSectionSeparator()
        {
            // Empty StringBuilder.

            StringBuilder oStringBuilder = new StringBuilder();

            StringUtil.AppendSectionSeparator(oStringBuilder);

            Assert.AreEqual(0, oStringBuilder.Length);
        }
Example #2
0
        TestAppendSectionSeparator2()
        {
            // Non-empty StringBuilder.

            StringBuilder oStringBuilder = new StringBuilder();

            oStringBuilder.Append("abc");
            StringUtil.AppendSectionSeparator(oStringBuilder);

            Assert.AreEqual("abc\r\n\r\n", oStringBuilder.ToString());
        }
        ReadTopColumn
        (
            ListObject oTopMetricsTable,
            String sColumnHeader,
            StringBuilder oTopMetrics
        )
        {
            Debug.Assert(oTopMetricsTable != null);
            Debug.Assert(!String.IsNullOrEmpty(sColumnHeader));
            Debug.Assert(oTopMetrics != null);

            StringBuilder oTopColumn     = new StringBuilder();
            Boolean       bColumnIsEmpty = true;

            oTopColumn.Append(sColumnHeader);
            oTopColumn.Append(':');

            ExcelTableReader oExcelTableReader =
                new ExcelTableReader(oTopMetricsTable);

            foreach (ExcelTableReader.ExcelTableRow oRow in
                     oExcelTableReader.GetRows())
            {
                String sItemName;

                if (oRow.TryGetNonEmptyStringFromCell(sColumnHeader,
                                                      out sItemName))
                {
                    StringUtil.AppendAfterEmptyLine(oTopColumn, sItemName);
                    bColumnIsEmpty = false;
                }
            }

            if (!bColumnIsEmpty)
            {
                StringUtil.AppendSectionSeparator(oTopMetrics);
                oTopMetrics.Append(oTopColumn.ToString());
            }
        }