Unit testing a WMI reboot

The other day I started working on a WMI wrapper that would encapsulate workstation management functionality (starting and stopping services, querying workstations, etc.). Unit testing, as always, is important, but I inevitably came to one problem.

How do you unit test a method that reboots a workstation?

The answer: Run the unit test, and if your machine starts to shut down, that means it’s the end of the workday, and your test passed. (It was already 6PM on a Friday, so such behavior was justified.)

Bookmark and Share

Popularity: 7% [?]

Related Posts

What matters is what you make of yourself. I think that's what we should tell kids. Their job isn't to get good grades so they can get into a good college, but to learn and do. And not just because that's more rewarding than worldly success. That will increasingly be the route to worldly success.

-- Paul Graham

Post a Comment

Your email is never published nor shared. Required fields are marked *