Best way to run a class with two different DI injection types #4990
Unanswered
rodrigovaras
asked this question in
Q&A
Replies: 1 comment 9 replies
-
|
This is how the existing DI data source attribute looks: https://github.com/thomhurst/TUnit/blob/27a978e1a1355e09c16d0cb3b345bafbd4a8cd04/TUnit.Core/Attributes/TestData/DependencyInjectionDataSourceSourceAttribute.cs You'd basically need to adjust it to return two rows of object[] instead of just 1. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have a test class that has a main contract interface that is used by most of the test methods. I have 2 different implementations of that interface and I would like to test the same test class with 2 different DI injections. Right now I have to subclass the test class and manually pass the interface implementation to the base class. Result, 3 C# .cs files, would like to reduce to 1 where i can inject multiple combinations to the constructor.
Maybe there is already a way to achieve this and I'm missing it.
Would like something like this:
[MyDependencyInjectionDataSource()]
[MyDependencyInjectionDataSource()]
public class MyTest(IContract contract)
{
...
}
Beta Was this translation helpful? Give feedback.
All reactions