Exemplo n.º 1
0
        public ComparisonBuilder WithCustomFormatter <TDifference>(IDifferenceFormatter formatter)
            where TDifference : Difference
        {
            CustomFormatters[typeof(TDifference)] = formatter;

            return(this);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Formats the specified difference instructions and
 /// writes them to the specified writer.
 /// </summary>
 /// <param name="left">The original left-hand content.</param>
 /// <param name="right">The original right-hand content.</param>
 /// <param name="instructions">The instructions to format.</param>
 /// <param name="target">The target writer.</param>
 public static string Format <T>(this IDifferenceFormatter <T> formatter, IList <T> left, IList <T> right, IEnumerable <DifferenceInstruction> instructions)
 {
     if (formatter == null)
     {
         throw new ArgumentNullException("formatter");
     }
     using (var stringwriter = new StringWriter())
     {
         formatter.Format(left, right, instructions, stringwriter);
         return(stringwriter.ToString());
     }
 }
Exemplo n.º 3
0
 public CompareSyntax <TActual, TExpected> WithCustomFormatter <TDifference>(IDifferenceFormatter formatter)
     where TDifference : Difference
 {
     Builder.WithCustomFormatter <TDifference>(formatter);
     return(this);
 }