xmlunit comparisonformatter was not replaced

143 Views Asked by At

I have the following code for compare:

Diff diff = DiffBuilder.Compare(sourceFromPath1)
              .WithTest(sourceFromPath2)
              .WithAttributeFilter(attrItem => attributesToIgnore.All(attrNameToIgnore => attrItem.Name != attrNameToIgnore))
              .WithDifferenceEvaluator(new AttributeDifferenceEvaluatorNoCase(attributesToIgnoreCase).Evaluate)
              .WithComparisonFormatter(new CustomFormatter())
              .CheckForSimilar()
              .Build();

and the following code for CustomFormatter:

public class CustomFormatter : IComparisonFormatter
    {
        public string GetDescription(Comparison comparison)
        {
            return "Custom Description";
        }

        public string GetDetails(Comparison.Detail details, ComparisonType type, bool formatXml)
        {
            return "Custom Details";
        }
    }

But when running I see that the comparison formatter was not replaced, i.e., expected that methods GetDescription and will GetDetails will be called when Compare is called, but they were not. Is there something missing in the code?

0

There are 0 best solutions below