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 PluginHost( CatchExceptionGeneration catchMode ) { _plugins = new Dictionary<IPluginInfo, PluginProxy>(); _loadedPlugins = new Dictionary<Guid, PluginProxy>(); _loadedPluginsEx = new ReadOnlyCollectionOnICollection<PluginProxy>( _loadedPlugins.Values ); _serviceHost = new ServiceHost( catchMode ); _newlyLoadedPlugins = new List<PluginProxy>(); }
internal PluginHost(CatchExceptionGeneration catchMode) { _plugins = new Dictionary <IPluginInfo, PluginProxy>(); _loadedPlugins = new Dictionary <Guid, PluginProxy>(); _loadedPluginsEx = new ReadOnlyCollectionOnICollection <PluginProxy>(_loadedPlugins.Values); _serviceHost = new ServiceHost(catchMode); _newlyLoadedPlugins = new List <PluginProxy>(); }
public DefaultProxyDefinition( Type typeInterface, CatchExceptionGeneration errorCatch ) { if( !typeInterface.IsInterface ) { throw new ArgumentException( "Must be an interface.", "typeInterface" ); } _typeInterface = typeInterface; _errorCatch = errorCatch; _isDynamicService = typeof( IDynamicService ).IsAssignableFrom( typeInterface ); }
public DefaultProxyDefinition(Type typeInterface, CatchExceptionGeneration errorCatch) { if (!typeInterface.IsInterface) { throw new ArgumentException("Must be an interface.", "typeInterface"); } _typeInterface = typeInterface; _errorCatch = errorCatch; _isDynamicService = typeof(IDynamicService).IsAssignableFrom(typeInterface); }
public ServiceHost(CatchExceptionGeneration catchMode) { _eventSender = this; _catchMode = catchMode; _proxies = new Dictionary <Type, ServiceProxyBase>(); _currentDepth = 0; _defaultConfiguration = new SimpleServiceHostConfiguration(); _configurations = new List <IServiceHostConfiguration>(); _configurations.Add(_defaultConfiguration); _untrackedErrors = new List <ILogErrorCaught>(); UntrackedErrors = new ReadOnlyListOnIList <ILogErrorCaught>(_untrackedErrors); }
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 ); } }