I am working to bring as much logic out of the user control as possible so that it can be tested on the module in order to reduce the burden of manual testing. I am having problems with situations where the test method creates a complex result; By writing a test case that computes the result, it will include a record of what is essentially the test code in the test itself.
For example, I have a class GeometryGeneratorthat creates WPF geometry based on class properties. In one configuration is generated PathGeometry, consisting of ArcSegment. I can calculate which arc properties should be based on test parameters, but this calculation is identical to the code I'm trying to verify. This seems to make the test ineffective; if there is an error in the calculation, there will be an error in the test, and if changes as a result of a change in the method can change in the test.
What should I do with this situation? The only approach I came up with is to manually calculate the results of my test cases and hard-code these values ββin the tests. Is this an acceptable approach (it seems that I would do if I wrote tests before implementation)?
Owenp source
share