MembersToInclude failure with List property
See original GitHub issueProject info
<TargetFramework>netcoreapp2.2</TargetFramework>
...
<PackageReference Include="CompareNETObjects" Version="4.64.0" />
Classes
public class Parent {
public List<Child> Children { get; set; }
}
public class Child {
public bool BoolA { get; set; }
public bool BoolB { get; set; }
}
...
Parent a = new Parent {
Children = new List<Child>
{
new Child {
BoolA = true,
BoolB = false
},
new Child {
BoolA = false,
BoolB = true
}
}
}
Parent b = new Parent {
Children = new List<Child>
{
new Child {
BoolA = false,
BoolB = true
},
new Child {
BoolA = true,
BoolB = false
}
}
}
AreEqual = false (as expected):
ComparisonConfig config = new ComparisonConfig()
CompareLogic compareLogic = new CompareLogic(config);
ComparisonResult result = _compareLogic.Compare(a, b);
//result.AreEqual = false (as expected)
AreEqual = true (bug):
ComparisonConfig config = new ComparisonConfig
{
MembersToInclude = new List<string>
{
"Children"
}
};
CompareLogic compareLogic = new CompareLogic(config);
ComparisonResult result = _compareLogic.Compare(a, b);
//result.AreEqual = true (bug)
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Group: Resource failing when using 'MembersToInclude' to ...
I have a DSC file with a resource hashtable configured similar to the following: Group AdminGroupMembership { Ensure = "Present" GroupName ...
Read more >DSC GroupSet Resource - PowerShell
MembersToInclude, Use this property to add members to the existing membership of the group. The value of this property is an array of...
Read more >DSC Group Resource - PowerShell
MembersToInclude, Use this property to add members to the existing membership of the group. The value of this property is an array of...
Read more >FluentAssertions Should().BeEquivalentTo() fails with Lists ...
I suspect that the interface IDomainEvent is without any public properties. That explains the exception you're seeing, as the logic in ...
Read more >DSC group resource can't remove domain user from local ...
Using either the MembersToExclude or MembersToInclude properties in the same configuration as this property will generate an error.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have no idea. You will need to debug the source code. I wish I had never put in that feature. It is just all heartache.
This is by design. None of the child properties are included so they are not compared. You will also need to add Parent, Child, BoolA, and BoolB