Is it possible to have a mix of loose and strict modes?
See original GitHub issueI’d like mock to behave in a way described in Mark’s article
I’d consider as a command any method returning void
/Task
/ValueTask
, query - for anything else.
So, whenever commands are called, I can verify the call, and when query is performed, the exception is thrown unless the result is explicitly defined.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Moq, strict vs loose usage
I used to use strict mocks when I first starting using mocks in unit tests. This didn't last very long. There are really...
Read more >Loose mode vs strict mode loop detection : r/networking
My 2nd question is between strict mode and loose mode, it seems like strict mode will only block loops that would happen if...
Read more >What is the difference between RPF strict and RPF loose mode?
RPF Loose: RPF loose mode looks for a existence of a route to the source in the routing table. RPF check will pass...
Read more >Basic Wireless Settings - DD-WRT Wiki
Available Settings: Off, 802.11h Loose, 802.11h Strict, 802.11d ... In Mixed mode, dd-wrt routers are able to offer various wifi network ...
Read more >Understand the Extended Ping and Extended Traceroute ...
The normal ping works both in the user EXEC mode and the privileged EXEC mode. ... (Loose Source Routing, Strict Source Routing, Record...
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 FreeTop 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
Top GitHub Comments
Ah, I see!
Hi, @voroninp. There’s nothing like that built into FakeItEasy itself, and I’m not sure if there’s widespread demand, but it wouldn’t be too hard to configure Fakes in this way. One could make the Fake strict and then override the strictness for the methods one cared about. Here’s a very rough attempt, whose tests pass:
Of course there are many ways to optimize this. For example, one could apply the configuration via an implicit creation option. Or possibly by adding an
IFakeOptions
extension. This is howCallsBaseMethods
is implemented, in fact.