NSubstitute
NSubstitute copied to clipboard
Received.InOrder does not verify property getters
Describe the bug
Property getters are not checked inside Received.InOrder
To Reproduce
I would expect this test to fail. Nowhere is the substitute's Count property called.
[Test]
public void CheckPropertyGet()
{
var list = Substitute.For<ICollection<int>>();
Received.InOrder(() =>
{
_ = list.Count;
_ = list.Received().Count; // 2nd attempt to get it working - even though this upsets the analysers
});
}
Expected behaviour
This test should fail.
If for some technical reason property getters cannot be supported in Received.InOrder, then I guess the analyzers should highlight this
Environment: NSubstitute 5.1.0 NSubstitute.Analyzers 1.0.17 Platform: Net8 on Windows
Additional context Add any other context about the problem here.