public void Tests3(string html, bool expectedResult)
        {
            var elementSource = ToComparisonSource(html);
            var sut           = new SourceMap(elementSource);

            sut.Contains("foo").ShouldBe(expectedResult);
        }
        public void Test2()
        {
            var elementSource = ToComparisonSource(@"<p></p>");
            var sut           = new SourceMap(elementSource);

            Should.Throw <System.Collections.Generic.KeyNotFoundException>(() => sut["foo"]);
        }
        public void Test4()
        {
            var elementSource = ToComparisonSource(@"<p foo=""bar"" baz=""foo""></p>");
            var sut           = new SourceMap(elementSource);

            sut.Remove((in AttributeComparisonSource cs) => cs.Attribute.Name == "foo" ? FilterDecision.Exclude : FilterDecision.Keep);

            sut.Count.ShouldBe(1);
            sut.Contains("foo").ShouldBeFalse();
        }
        public void Test5()
        {
            var elementSource = ToComparisonSource(@"<p foo=""bar"" baz=""foo""></p>");
            var sut           = new SourceMap(elementSource);
            var foo           = sut["foo"];

            sut.MarkAsMatched(foo);

            sut.GetUnmatched().ShouldNotContain(foo);
            sut.GetUnmatched().Count().ShouldBe(1);
        }
        public void Test1()
        {
            var elementSource = ToComparisonSource(@"<p foo=""bar"" baz=""foo""></p>", ComparisonSourceType.Test);
            var sut           = new SourceMap(elementSource);

            sut.SourceType.ShouldBe(ComparisonSourceType.Test);
            sut.Count.ShouldBe(2);
            sut["foo"].ShouldSatisfyAllConditions(
                (cs) => cs.Attribute.Name.ShouldBe("foo"),
                (cs) => cs.ElementSource.ShouldBe(elementSource)
                );
            sut["baz"].ShouldSatisfyAllConditions(
                (cs) => cs.Attribute.Name.ShouldBe("baz"),
                (cs) => cs.ElementSource.ShouldBe(elementSource)
                );
        }
 private static IEnumerable <AttributeComparison> AttributeNameMatcher(IDiffContext context, SourceMap controlAttrs, SourceMap testAttrs)
 {
     foreach (var ctrlAttrSrc in controlAttrs)
     {
         if (testAttrs.Contains(ctrlAttrSrc.Attribute.Name))
         {
             yield return(new AttributeComparison(ctrlAttrSrc, testAttrs[ctrlAttrSrc.Attribute.Name]));
         }
     }
 }
 private static IReadOnlyList <AttributeComparison> NoneAttributeMatcher(
     IDiffContext context,
     SourceMap controlAttributes,
     SourceMap testAttributes) => Array.Empty <AttributeComparison>();