File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33## XMLUnit.NET 2.9.1 - /not released, yet/
44
5+ * added a new ` FullDescription ` method to ` Diff ` that provides a
6+ string-representation of all differences - not just the first one
7+ like ` ToString ` does.
8+ Based on Java PR [ xmlunit/#235 ] ( https://github.com/xmlunit/xmlunit/issues/235 ) by
9+ [ @Boiarshinov ] ( https://github.com/Boiarshinov )
10+
511## XMLUnit.NET 2.9.0 - /Released 2020-10-30/
612
713* ` ISource ` now extends ` IDisposable ` to allow releasing unmanaged
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ limitations under the License.
1414
1515using System . Collections . Generic ;
1616using System . Linq ;
17+ using System . Text ;
1718
1819namespace Org . XmlUnit . Diff {
1920
@@ -106,5 +107,35 @@ public string ToString(IComparisonFormatter formatter) {
106107 }
107108 return differences . First ( ) . Comparison . ToString ( formatter ) ;
108109 }
110+
111+ /// <summary>
112+ /// Returns a string representation of this diff using
113+ /// internal IComparisonFormatter or DefaultComparisonFormatter
114+ /// if formatter wasn't set.
115+ /// </summary>
116+ /// <remarks>
117+ /// Each comparison result separated by the end of the line.
118+ /// </remarks>
119+ /// <returns>a string representation of this diff</returns>
120+ public string FullDescription ( ) {
121+ return FullDescription ( formatter ) ;
122+ }
123+
124+ /// <summary>
125+ /// Returns a string representation of this diff using the
126+ /// given IComparisonFormatter}
127+ /// </summary>
128+ /// <param name="formatter">the formatter to use</param>
129+ /// <returns>a string representation of this diff</returns>
130+ public string FullDescription ( IComparisonFormatter formatter ) {
131+ if ( ! HasDifferences ( ) ) {
132+ return "[identical]" ;
133+ }
134+ StringBuilder result = new StringBuilder ( ) ;
135+ foreach ( Difference d in Differences ) {
136+ result . AppendLine ( d . Comparison . ToString ( formatter ) ) ;
137+ }
138+ return result . ToString ( ) . TrimEnd ( ) ;
139+ }
109140 }
110141}
You can’t perform that action at this time.
0 commit comments