TestAppendLineAfterEmptyLine3() { // Empty StringBuilder, non-empty string. StringBuilder oStringBuilder = new StringBuilder(); Assert.IsTrue(StringUtil.AppendLineAfterEmptyLine( oStringBuilder, "abc")); Assert.AreEqual("abc\r\n", oStringBuilder.ToString()); }
TestAppendLineAfterEmptyLine2() { // Empty StringBuilder, empty string. StringBuilder oStringBuilder = new StringBuilder(); Assert.IsFalse(StringUtil.AppendLineAfterEmptyLine( oStringBuilder, String.Empty)); Assert.AreEqual(0, oStringBuilder.Length); }
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()); }
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()); }
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); } } }