-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
@replaysMike @MohammadHadi2031 Thank you for the fast PR and Merge, but I believe that #26 introduced a bug :(. Nested exclude strings not do not exclude the properties now.
I have complex objects that have nested collection properties, I use a list of strings to exclude certain properties (".positions.name", ".positions.locations.id",...) but now they are not excluded, only ones like ".Id", ".Name" correctly exclude.
Here is a simple test that passes on fe9c29f (Previous latest version) but fails on d03f685 (Latest version)
.Id is excluded correctly, but .Bs.Name is not
[Test]
public void ExcludeByStringTest()
{
var B1s = new List<B> { new B { Id = 10, Name = "Test 10" }, new B { Id = 11, Name = "Test 11" } };
var B2s = new List<B> { new B { Id = 10, Name = "Test 10" }, new B { Id = 12, Name = "Test 12" } };
var A1 = new A();
A1.Id = 1;
A1.Bs = B1s;
var A2 = new A();
A1.Id = 2;
A2.Bs = B2s;
var diff = A1.Diff(A2, propertiesToExcludeOrInclude: new string[] { ".Bs.Name", ".Id"});
Assert.AreEqual(1, diff.Count);
}
class A
{
public List<B> Bs { get; set; } = new List<B>();
public int Id { get; set; }
}
class B
{
public int Id { get; set; }
public string Name { get; set; }
}MohammadHadi2031
Metadata
Metadata
Assignees
Labels
No labels