Started to write tests for our old project. Everything is simple - [TestClass], [TestMethod] etc.
But there's some method - we call it Create for example - and it have 4 nullable parameters - Create(int? a, int? b, Guid? c, int? d). There's no way to rewrite the method, and while I can enclose main call into delegate - Action or Func - anyway I must call near 16 variants of function in case of testing all situations, where params can be some one predefined value or can be null:

Test(null,null,null,null); 
Test(1,null,null,null); 
Test(1,1,null,null);
Test(null,1,null,null);
//etc

But why if there's not only 1 and null, but even 2?Robot Bender saw 2
I can try to write something, which will receive sets and produce calls, but maybe there's a ready-to-use solution without third-party components?

0 Answers