public void Test001() { var control = "<p>control</p>"; var test = "<p>test</p>"; var sut = DiffBuilder .Compare(control) .WithTest(test); sut.Control.ShouldBe(control); sut.Test.ShouldBe(test); }
public void Test004() { var control = "<p foo>hello world</p>"; var test = "<p foo>hello world</p>"; var nodeFilterCalled = false; var attrFilterCalled = false; var nodeMatcherCalled = false; var attrMatcherCalled = false; var nodeComparerCalled = false; var attrComparerCalled = false; var diffs = DiffBuilder .Compare(control) .WithTest(test) .WithOptions(options => options .AddDefaultOptions() .AddFilter((in ComparisonSource source, FilterDecision currentDecision) => { nodeFilterCalled = true; return(currentDecision); })
public void Test003() { var control = @"<p attr=""foo"" missing>hello <em>world</em></p>"; var test = @"<p attr=""bar"" unexpected>world says <strong>hello</strong></p>"; var diffs = DiffBuilder .Compare(control) .WithTest(test) .Build() .ToList(); diffs.Count.ShouldBe(6); diffs.SingleOrDefault(x => x is AttrDiff).ShouldNotBeNull(); diffs.SingleOrDefault(x => x is MissingAttrDiff).ShouldNotBeNull(); diffs.SingleOrDefault(x => x is UnexpectedAttrDiff).ShouldNotBeNull(); diffs.SingleOrDefault(x => x is NodeDiff).ShouldNotBeNull(); diffs.SingleOrDefault(x => x is MissingNodeDiff).ShouldNotBeNull(); diffs.SingleOrDefault(x => x is UnexpectedNodeDiff).ShouldNotBeNull(); }
public void Test002() { Should.Throw <ArgumentNullException>(() => DiffBuilder.Compare(null !)).ParamName.ShouldBe(nameof(DiffBuilder.Control)); Should.Throw <ArgumentNullException>(() => DiffBuilder.Compare("").WithTest(null !)).ParamName.ShouldBe(nameof(DiffBuilder.Test)); }