public TestContext(bool handMadeProxy, bool startPlugin, CatchExceptionGeneration catchExceptionsForRealProxy) { PluginHost = new PluginHost(catchExceptionsForRealProxy); RealPlugin = new ChoucroutePlugin(); ConsumerPlugin = new ConsumerPlugin(this); PluginHost.PluginCreator = key => key == PluginPluginId ? (IPlugin)RealPlugin : ConsumerPlugin; PluginHost.ServiceReferencesBinder = newPluginsLoaded => { }; if (handMadeProxy) { ServiceHost.SetManualProxy(typeof(IChoucrouteService), IChoucrouteServiceHandMadeProxy.CreateProxy()); } // The proxy is itself a IChoucrouteService. Assert.That(Service is IChoucrouteService); Assert.That(Service is ServiceProxyBase); // We check the Running attribute. Assert.That(Service.Status == RunningStatus.Disabled); Assert.That(PluginProxy == null); if (startPlugin) { PluginHost.Execute(ReadOnlyListEmpty <IPluginInfo> .Empty, ReadOnlyListEmpty <IPluginInfo> .Empty, new[] { PluginPluginId }); Assert.That(PluginProxy.Status == RunningStatus.Started); Assert.That(Service.Status == RunningStatus.Started); } }
internal void EnsureStoppedService() { if (ServiceProxyBase.Status == RunningStatus.Disabled) { PluginHost.Execute(ReadOnlyListEmpty <IPluginInfo> .Empty, ReadOnlyListEmpty <IPluginInfo> .Empty, new[] { PluginPluginId }); PluginHost.Execute(ReadOnlyListEmpty <IPluginInfo> .Empty, new[] { PluginPluginId }, ReadOnlyListEmpty <IPluginInfo> .Empty); } Assert.That(ServiceProxyBase.Status == RunningStatus.Stopped); }