How can I unit test a Windows Service?

I’d probably recommend designing your app so the “OnStart” and “OnStop” overrides in the Windows Service just call methods on a class library assembly. That way you can automate unit tests against the class library methods, and the design also abstracts your business logic from the implementation of a Windows Service.

In this scenario, testing the “OnStart” and “OnStop” methods themselves in a Windows Service context would then be an integration test, not something you would automate.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)