Comment 4 for bug 928421

Revision history for this message
Charlie Poole (charlie.poole) wrote :

Sorry, I misunderstood and confused the issue. The first issue remains the same, however.

Services in NUnit are instantiated by the mainline code. Where dependencies exist, as in
the case of DomainManager, which depends on the ProjectService service and the
UserSettings service, those services must be created and initialized before _any_
service is used.

So your code should look something like what console runner does, with the exception that
you only need to instantiate and initialize DomainManager and its dependencies. I didn't
recheck what the dependencies are, but assuming it's only the two above, your code
would look like this:

   ServiceManager.Services.AddService( new SettingsService() );
   ServiceManager.Services.AddService( new ProjectService() );
   ServiceManager.Services.AddService( new DomainManager() );

   ServiceManager.Services.InitializeServices();

I'm rejecting the bug because it can't be fixed in NUnit without breaking NUnit.

Charlie