Calls are recorded after applying the best rule, not when received
See original GitHub issueFrom StackOverflow question FakeItEasy assert that method call to method.
@baruchiro had a test that passed in 2.2.0 and failed in 5.1.0:
public class Foo
{
public virtual void MethodA()
{
MethodB();
}
public virtual void MethodB() { }
}
…
var foo_fake = A.Fake<Foo>(options => options.CallsBaseMethods());
foo_fake.MethodA();
A.CallTo(() => foo_fake.MethodA()).MustHaveHappened()
.Then(A.CallTo(() => foo_fake.MethodB()).MustHaveHappened());
The failure indicated that both calls happened, but in the wrong order.
We inadvertently changed the behaviour in #1124, released in 3.4.2, when we started recording the call in the FakeManager after applying the best-matching rule, rather than in the CastleInvocationCallAdapter
.
We could record the call before looking for the best rule to apply. I think this is a good fix anyhow, as it more accurately reflects when the call was made, irrespective of any time FakeItEasy takes to figure out what to do with it.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Know Your Rights: Phone Call Recording Laws by State
Given the inconsistencies between state and federal laws, Justia.com recommends following the strictest call recording laws that apply to ...
Read more >Calls may be recorded for training and quality purposes
“Calls may be recorded for training and quality purposes” – It's a phrase we've all heard when calling a company or organisation, but...
Read more >The Risks of Recording Business Calls
Companies record incoming calls for a variety of reasons. True, it is sometimes for purposes of training an employee when complaints are made....
Read more >Call recording laws
Review guidelines about some things you'll need to consider when recording and transcribing calls in HubSpot.
Read more >Recording Phone Calls and Conversations - 50 State Survey
Federal law (18 U.S.C. § 2511) requires one-party consent, which means you can record a phone call or conversation so long as you...
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
@nkosihenry, thanks. I see your point about the wording and the semantics. Sadly, to some degree, this is in the eye of the reader.
To me, “A call to blah must have happened” talks more about when the call happened. I’m quick to say “no” to features, but I don’t really see much benefit in differentiating between when a call is begun and when it finishes, especially when the goings-on between the two events should all be FakeItEasy or user-supplied test code. In the interest of keeping the API small, I think we should supply only the one check, and I think
MustHaveHappened
adequately conveys the intent (also requires no rework for the vast majority of users for whom we’re talking about a too-fine distinction).This change has been released as part of FakeItEasy 5.1.1.