Example #1
0
        TestAppendLineAfterEmptyLine3()
        {
            // Empty StringBuilder, non-empty string.

            StringBuilder oStringBuilder = new StringBuilder();

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

            Assert.AreEqual("abc\r\n", oStringBuilder.ToString());
        }
Example #2
0
        TestAppendLineAfterEmptyLine2()
        {
            // Empty StringBuilder, empty string.

            StringBuilder oStringBuilder = new StringBuilder();

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

            Assert.AreEqual(0, oStringBuilder.Length);
        }
Example #3
0
        TestAppendLineAfterEmptyLine5()
        {
            // Non-empty StringBuilder, empty string.

            StringBuilder oStringBuilder = new StringBuilder();

            oStringBuilder.Append("123");

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

            Assert.AreEqual("123", oStringBuilder.ToString());
        }
Example #4
0
        SummarizeGraphInternal
        (
            GraphHistory oGraphHistory,
            AutoFillWorkbookResults oAutoFillWorkbookResults,
            OverallMetrics oOverallMetrics,
            String oTopNByMetrics,
            String oTwitterSearchNetworkTopItems
        )
        {
            Debug.Assert(oGraphHistory != null);
            Debug.Assert(oAutoFillWorkbookResults != null);

            StringBuilder oStringBuilder = new StringBuilder();

            AppendGraphHistoryValues(oGraphHistory, oStringBuilder,
                                     GraphHistoryKeys.ImportDescription,
                                     GraphHistoryKeys.GraphDirectedness,
                                     GraphHistoryKeys.GroupingDescription,
                                     GraphHistoryKeys.LayoutAlgorithm
                                     );

            StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                                                oAutoFillWorkbookResults.ConvertToSummaryString());

            if (oOverallMetrics != null)
            {
                StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                                                    "Overall Graph Metrics:");

                oStringBuilder.AppendLine(
                    oOverallMetrics.ConvertToSummaryString());
            }

            StringUtil.AppendLineAfterEmptyLine(oStringBuilder, oTopNByMetrics);

            StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                                                oTwitterSearchNetworkTopItems);

            AppendGraphHistoryValues(oGraphHistory, oStringBuilder,
                                     GraphHistoryKeys.Comments
                                     );

            return(oStringBuilder.ToString());
        }
Example #5
0
        AppendGraphHistoryValues
        (
            GraphHistory oGraphHistory,
            StringBuilder oStringBuilder,
            params String [] asGraphHistoryKeys
        )
        {
            Debug.Assert(oGraphHistory != null);
            Debug.Assert(oStringBuilder != null);
            Debug.Assert(asGraphHistoryKeys != null);

            String sGraphHistoryValue;

            foreach (String sGraphHistoryKey in asGraphHistoryKeys)
            {
                if (oGraphHistory.TryGetValue(sGraphHistoryKey,
                                              out sGraphHistoryValue))
                {
                    StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                                                        sGraphHistoryValue);
                }
            }
        }