Description
ThatArePublicOrInternal property in PropertyInfoSelector.cs only selects the public or internal properties that have get accessor
Complete minimal example reproducing the issue
When selecting the public or internal properties of a type, it selects only the ones with get accessors. If a property has only set accessor it will not be selected.
E.g.
public class TestClassForPropertyInfoSelector{
private static string myPrivateStaticStringField;
public static string PublicStaticStringProperty { set => myPrivateStaticStringField = value; }
public static string InternalStaticStringProperty { get; set; }
}
// Arrange
Type type = typeof(TestClassForPropertyInfoSelector);
// Act
IEnumerable<PropertyInfo> properties = type.Properties().ThatArePublicOrInternal.ToArray();
// Assert
properties.Should().HaveCount(2);
Expected behavior:
The test should pass because one property is internal and the other one is public and both should be selected
Actual behavior:
The test fails with following message:
Expected properties to contain 2 item(s), but found 1: {InternalStaticStringProperty}.
Additional Information
Using Visual Studio 2022