-
Notifications
You must be signed in to change notification settings - Fork 731
Closed
Labels
Description
Description
private protected members are check against whereas private, protected, and internal members are all ignored when comparing two objects using BeEquivalentTo. I would have expected private protected which has a subset of the visibility of protected or internal to be ignore in the default checks as well.
Reproduction Steps
public class TestClass {
[ Fact ]
public void EquivalencyOfPrivateProtectedShouldMatchProtected( ) {
Class1 class1 = new ();
Class2 class2 = new ();
Class3 class3 = new ();
Class4 class4 = new ();
class1.Should().BeEquivalentTo( class2 );
class1.Should().BeEquivalentTo( class3 );
class1.Should().BeEquivalentTo( class4 ); // <-- FAILS HERE ONLY
}
}
class Class1 {
public string Name = "Hello";
}
class Class2 {
public string Name = "Hello";
protected int _protectedNumber = 2;
}
class Class3 {
public string Name = "Hello";
internal int _protectedNumber = 2;
}
class Class4 {
public string Name = "Hello";
private protected int _protectedNumber = 2;
}Expected behavior
By default I would have expected all of these tests to pass.
Actual behavior
All tests pass except for the one where the differing field is private protected
Regression?
No response
Known Workarounds
No response
Configuration
.NET 7.0
Fluent Assertions 6.12
Other information
No response
Are you willing to help with a pull-request?
No