question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calls are recorded after applying the best rule, not when received

See original GitHub issue

From 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
blairconradcommented, Apr 14, 2019

@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).

1reaction
blairconradcommented, Apr 15, 2019

This change has been released as part of FakeItEasy 5.1.1.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found