Reputation: 36431
I'm just starting out with unit testing in C#.
I have been reading about unit testing for a long time now, and I've already been playing around with NUnit, but this is the first time that I actually try to write real tests for real code.
But my problem is:
I'm having a hard time to come up with things that I can actually test.
The project I want to test is a conversion library (to convert lists of POCOs to ADO Recordsets).
So far, I've come up with only two things to test:
RS!Foo == POCO.Foo
)So, my questions are:
Upvotes: 3
Views: 1045
Reputation: 5293
Try the Pex tool from Microsoft. It generates Unit tests after analyzing your code. Just a quick install of Visual studio plugin. Then Right click the class/method you want to test and in the context menu get Pex to generate all the possible code paths for you.
Upvotes: 0
Reputation: 564433
There are quite a few things to test. I would also suggest thinking about and potentially verifying:
POCO
don't map through correctlyUpvotes: 3
Reputation: 49095
Add a conversion test case where you know the exact input and output. Then test that the code produces that answer exactly.
Upvotes: 1