Dependency Injection in LINQPad 7
Is it possible to do dependency injection testing in LINQPad 7? I'm testing a small script with a couple classes with interfaces and attempting to inject on into the other's constructor like I would do in Visual Studio, but I'm not sure how to tell LINQPad to use injection for those constructor items instead of expecting a passed parameter.
It should work as it does in Visual Studio. What part of the code are you having trouble with?
Yes it is possible. To test your classes you'll need to reference a dependency injection library and config your DI container.
Here's an example LINQPad script demonstrating how to do that using .NET Core's Dependency injection library:
And here's the Microsoft docs page that I used to create the script:
I hope this helps, cheers
linqpad does not work on https://github.com/YairHalberstadt/stronginject