Ejemplo n.º 1
0
        public void Test003(WhitespaceOption whitespaceOption)
        {
            var sut        = new TextNodeComparer(whitespaceOption);
            var comparison = ToComparison("  hello\n\nworld ", "  hello\n\nworld ");

            sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Same);
        }
Ejemplo n.º 2
0
        public void Test51(string tag, WhitespaceOption whitespaceOption)
        {
            var sut    = new TextNodeFilter(WhitespaceOption.Normalize);
            var pre    = ToNode($"<{tag} diff:whitespace=\"{whitespaceOption.ToString()}\">\n\t</{tag}>");
            var source = pre.FirstChild.ToComparisonSource(0, ComparisonSourceType.Control);

            sut.Filter(source, FilterDecision.Keep).ShouldBe(FilterDecision.Exclude);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a text node filter with the provided option.
 /// </summary>
 /// <param name="option"></param>
 public TextNodeFilter(WhitespaceOption option)
 {
     Whitespace = option;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Enables the one-to-one node-matching strategy during diffing.
 /// </summary>
 public static IDiffingStrategyCollection AddTextComparer(this IDiffingStrategyCollection builder, WhitespaceOption whitespaceOption, bool ignoreCase)
 {
     builder.AddFilter(new TextNodeFilter(whitespaceOption).Filter, StrategyType.Specialized);
     builder.AddComparer(new TextNodeComparer(whitespaceOption, ignoreCase).Compare, StrategyType.Specialized);
     return(builder);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Instantiates a <see cref="TextNodeComparer"/> with the provided configuration.
 /// </summary>
 public TextNodeComparer(WhitespaceOption option = WhitespaceOption.Preserve, bool ignoreCase = false)
 {
     Whitespace = option;
     IgnoreCase = ignoreCase;
 }