Reputation: 1893
I'm working on small documents compiler. I'm using .NET expression trees to create code that will generate documents. I think that it is impossible to write Unit tests which test generated expression trees structures as it is just code and I can write it in many ways to get same result. I think that the only solution is to write integration tests that will run documents compilation and execution and check output result. I want to know if integration testing is the only one option in this situation?
Upvotes: 0
Views: 89
Reputation: 308848
I think that it is impossible to write Unit tests which test generated expression trees structures as it is just code
I don't agree.
You need two tests for each input case: one to ensure that the generated expression tree is produced for a known input and another to check the code that's emitted when you walk the AST. "Impossible"? Hardly.
Upvotes: 1