c# - How do I test with multiple input combinations? -
i have piece of code need test, layered in 3 parts:
web api controllerpersistence/logic layersystem calls persistence
it's basic get/post/put/delete call system. instance, in controller have getall method calls get in second layer, in turn calls either sql database method either web api method.
the scenarios: mock second layer , call controller. mock system calls , call second layer. mock system calls , call controller.
for each scenario, have multiple test inputs, each method in controller/second layer.
what best way it? want have little possible code duplication.
i can use datasource attribute on test , have each test layer value select type of mocking do, , each layer value, add test data(input parameters). test data common layer values, mean have duplicate each layer value. have same layer values methods in controller/persistence layer, again duplicate.
i factor out in way layer values, common tests(think of class level values) , have specific input values each method in controller(method level). , each method then, have test in sort of cross product in between general layer values , specific method input values. how achieve that?
thanks, ciprian.
Comments
Post a Comment