jeudi 7 mars 2019

How to dynamically generate nested loop based on loop variables

I'm building a test program. this program will iterate a lot of parameters combination and return test result for every case. My question is that it is not all types of parameters are sent into program. For example, Param A, Param B, and Param C come in this time. then I'll make 3 loops for all parameter combinations:

foreach (var a in paramA)
   foreach (var b in paramB)
       foreach (vac c in paramC)

But sometimes there are ParamA, ParamD, or then I have to make loops like the following

foreach (var a in paramA)
   foreach (vac d in paramD)

So I wonder if there's a certain design pattern or technique for this particular problem

Thanks

Aucun commentaire:

Enregistrer un commentaire