Allow to pass a delegate to Wrapping()
See original GitHub issueIn certain test scenarios on our side we want to set up fake calls for a wrapping fake before the actual application started and the actual object to be wrapped becomes available.
It would be great to have an overload for Wrapping() that takes a delegate to allow the following:
1. Set up fake object wrapping a delegate that returns a field which is currently null
2. Start the subject-under-test application
3. Obtain the object-to-be-wrapped from the application and save it to the field
4. Any calls to the fake which are not set up are now passed on to the delegate -> to the field
Best regards, D.R.
Issue Analytics
- State:
- Created 5 months ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
c# - How can I use delegates to pass methods in a thread ...
new Thread() takes a ThreadStart (or ParameterisedThreadStart) argument, and your DoDelegatedMethod callback doesn't have the right ...
Read more >Using Delegates - C# Programming Guide
An instantiated delegate can be invoked as if it were the wrapped method ... This allows a method to accept a delegate as...
Read more >Wrapping delegates with Swift async/await and continuations
In this article you will learn how to convert or use existing delegate patterns and wrap them with Swift's structured concurrency to use...
Read more >Passing delegated properties to functions (instead of ...
I just pass Boolean that wrapped in object (somenting like AtomicBoolean) as last parameter. abstract class Observable { fun subscribe() ...
Read more >What is the purpose of a wrapper class that does nothing ...
This pattern is called "Delegation". Here is a simple example of an implementation that adds a System.out when setLocale is called:
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
Congratulations, @drauch! Happy fathering!
On to business. Because I still don’t understand, it sounds to me like at the time you decide to swap in the Fake, you already have access to the original service that you’d be wrapping. I’m sure I’m still missing something, because if it were that easy, you wouldn’t be here. Still, we at FakeItEasy Canada don’t understand the situation in which this feature would apply, nor how far-reaching the benefit would be.
I propose that until you (or maybe one of your teammates, since it sounds like this is a work project) can show up with an example, or very detailed explanation of the flow (which we can ask annoying questions about), we close the issue. And then it can be reopened when there’s more information.
That’s correct, yes.