コード例 #1
0
        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);
            }
        }
コード例 #2
0
        static public IChoucrouteServiceHandMadeProxy CreateProxy()
        {
            IChoucrouteServiceHandMadeProxy p = new IChoucrouteServiceHandMadeProxy(new ChoucrouteServiceNotAvailable_UN());

            return(p);
        }