You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]publicvoidCheckPropertyGet(){varlist= 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.
The text was updated successfully, but these errors were encountered:
This is by design. IIRC including getters made some tests painful to write (e.g. nested subs; a.Nested.Call(), the a.Nested access would need to be in the exact order.) We could possibly include an overload with a parameter to adjust this behaviour.
Happy to accept doc updates here if you have time to send one through. 🙏
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.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 thisEnvironment:
NSubstitute 5.1.0
NSubstitute.Analyzers 1.0.17
Platform: Net8 on Windows
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: