I'm working on WinForms application.
I have group of tests classes, each class performs different thing but 80% of classes use almost identical constructors. I'm using reflection to dynamically create class instances in run time from List, there could be dozens of different and same type of tests.
currentTest = (ISystemTest)Activator.CreateInstance(classtype,
gui,
param1,
param2,
param3,
param4,
currentProgressUpdater);
and then run the instance via Action.
As i've said some constructors have slightly different signature. I used to work with switch statements but via reflection it becomes easier to maintain.
To work out the issue with different constructor signatures i have either some creative solution or to create large constructor with default values for test which doesn't need certain data.
So if you have creative solution to this problem i would love to hear it.
Example of constructors:
ClassName(gui, param1, param2, param3, progressUpdater)=> about 80% of current testsClassName(gui, param1,param4, param5)=> about 10% of current testsClassName(param4, param6)=> 10% of current tests
types are custom classes not string or ints
{}as the image), or hit ctrl+k