Ejemplo n.º 1
0
 /// <summary>
 /// Stringify the outcome using the fiven formatter
 /// </summary>
 /// <param name="formatter">the formatter to use</param>
 /// <returns>a string representation of the outcome</returns>
 public string ToString(IComparisonFormatter formatter)
 {
     if (!HasDifferences())
     {
         return("[identical]");
     }
     return(differences.First().Comparison.ToString(formatter));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates the result of comparing two documents.
 /// </summary>
 /// <param name="controlSource">the reference document</param>
 /// <param name="testSource">the test document</param>
 /// <param name="formatter">formatter to use</param>
 /// <param name="differences">list of differences found</param>
 public Diff(ISource controlSource, ISource testSource,
             IComparisonFormatter formatter,
             IEnumerable <Difference> differences)
 {
     this.controlSource = controlSource;
     this.testSource    = testSource;
     this.formatter     = formatter;
     this.differences   = differences;
 }
Ejemplo n.º 3
0
 /// <summary>
 ///   Use a custom Formatter for the Error Messages. The defaultFormatter is DefaultComparisonFormatter.
 /// </summary>
 public CompareConstraint WithComparisonFormatter(IComparisonFormatter comparisonFormatter)
 {
     this.comparisonFormatter = comparisonFormatter;
     return(this);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets a non-default formatter for the differences found.
 /// </summary>
 public DiffBuilder WithComparisonFormatter(IComparisonFormatter formatter)
 {
     this.formatter = formatter;
     return(this);
 }
 public XmlTester(ISimpleLogger logger, ILogAsserter logAsserter, IComparisonFormatter comparisonFormatter)
 {
     this.logger              = logger ?? throw new ArgumentNullException(nameof(logger));
     this.logAssert           = logAsserter ?? throw new ArgumentNullException(nameof(logAsserter));
     this.comparisonFormatter = comparisonFormatter ?? throw new ArgumentNullException(nameof(comparisonFormatter));
 }
 public XmlTester(ILogAsserter logAsserter, IComparisonFormatter comparisonFormatter) : this(new SimpleConsoleLogger(), logAsserter, comparisonFormatter)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Returns a string representation of this difference using the
 /// given IComparisonFormatter.
 /// <param name="formatter">the IComparisonFormatter to use</param>
 /// <return>a string representation of this difference</return>
 /// </summary>
 public string ToString(IComparisonFormatter formatter)
 {
     return(string.Format("{0} ({1})", Comparison.ToString(formatter), Result));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Returns a string representation of this comparison using the
 /// given IComparisonFormatter.
 /// <param name="formatter"> the IComparisonFormatter to use</param>
 /// <return>a string representation of this comparison</return>
 /// </summary>
 public string ToString(IComparisonFormatter formatter)
 {
     return(formatter.GetDescription(this));
 }