One Functionality, One Test: TDD is a form of Unit Test. The driven in the TDD means that to write code, you need to write the test first. And the best way to do is by focussing on only single functionality. Create a test that focuses on only one cause but sometimes one test is not enough.
I'm trying to be better about unit testing my code, but right now I'm writing a lot of code that deals with remote systems. SNMP, WMI, that sort of thing. With most classes I can mock up objects to test them, but how do you deal with unit testing a real system? For example, if my class goes out and gets the Win32_LogicalDisk object for a server, how could I possibly unit test it?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With