Ejemplo n.º 1
0
        TestAppendAfterEmptyLine2()
        {
            // Empty StringBuilder, empty string.

            StringBuilder oStringBuilder = new StringBuilder();

            Assert.IsFalse(StringUtil.AppendAfterEmptyLine(
                               oStringBuilder, String.Empty));

            Assert.AreEqual(0, oStringBuilder.Length);
        }
Ejemplo n.º 2
0
        TestAppendAfterEmptyLine3()
        {
            // Empty StringBuilder, non-empty string.

            StringBuilder oStringBuilder = new StringBuilder();

            Assert.IsTrue(StringUtil.AppendAfterEmptyLine(
                              oStringBuilder, "abc"));

            Assert.AreEqual("abc", oStringBuilder.ToString());
        }
Ejemplo n.º 3
0
        TestAppendAfterEmptyLine5()
        {
            // Non-empty StringBuilder, empty string.

            StringBuilder oStringBuilder = new StringBuilder();

            oStringBuilder.Append("123");

            Assert.IsFalse(StringUtil.AppendAfterEmptyLine(
                               oStringBuilder, String.Empty));

            Assert.AreEqual("123", oStringBuilder.ToString());
        }
Ejemplo n.º 4
0
        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());
            }
        }