I am currently building a piece of code that creates side-effects based on input parameters. It has around ten input parameters and about six available side-effects. Based on the input parameters, the chosen side-effects - one or multiple - differ.
I have started developing this code test first with a context/specification framework, because every input parameter is basically a context.
The resulting code so far is a deeply nested if-else structure.
I have implemented about 30% so far and the code - and the tests even more - are getting very complex, unwieldy and hard to understand. So much that I am doubting this is the correct approach.
The main problem are actually the tests, because I keep repeating the conditions for some of the deeper nested input parameters as well as for the resulting side-effects.
Are there design patterns for building and testing this kind of "decision graph"?
Please note that the input parameters are not fixed values. A lot of the logic is relativ, i.e. if input parameter 1 is less than input parameter 2.
The current output from my tests can be seen here: https://cloud.fire-development.com/f/12bcba0439/?raw=1
You can see that there is a lot of repetition, making it hard to reason about what it actually does.