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.)

Popularity: 6% [?]

Related posts:

  1. Unit testing an Activerecord domain model with NUnit
  2. Testing Windows Live Writer with WordPress
  3. The Visual Studio hosting process and 64-bit Windows
  4. Mocking indexed properties with Moq

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>