You want to have your windows service as a shell, there should be little code in there so you don't have to test it.
You should have every thing you want your service to do in a class.
You can unit test you class and if it works then reference it to your service.
This way when you have you class doing every thing you want then when its applied to your service every thing should work. :)
Will an event log you can see what your service is doing while it is running, also a nice way to test :D try that.
namespace WindowsService
{
public partial class MyService : ServiceBase
{
public MyEmailService()
{
InitializeComponent();
if (!System.Diagnostics.EventLog.SourceExists("MySource")) // Log every event
{
System.Diagnostics.EventLog.CreateEventSource(
"MySource", "MyNewLog"); // Create event source can view in Server explorer
}
eventLogEmail.Source = "MySource";
eventLogEmail.Log = "MyNewLog";
clsRetriveEmail Emails = new clsRetriveEmail();
eventLogEmail.WriteEntry("Populateing database with mail"); // log event
Emails.EmailGetList(); // Call class
}
protected override void OnStart(string[] args)
{
eventLogEmail.WriteEntry("Started");
}
protected override void OnStop()
{
eventLogEmail.WriteEntry("Stopped");
}
protected override void OnContinue()
{
eventLogEmail.WriteEntry("Continuing");
}
}
}