public async Task ShouldAllowMultipleStops()
        {
            var testee = new RunningEndpointInstance(
                new SettingsHolder(),
                new FakeBuilder(),
                new List<TransportReceiver>(),
                new FeatureRunner(new FeatureActivator(new SettingsHolder())),
                new MessageSession(new RootContext(null, null, null)), new FakeTransportInfrastructure());

            await testee.Stop();

            Assert.That(async () => await testee.Stop(), Throws.Nothing);
        }
Exemple #2
0
        public async Task ShouldAllowMultipleStops()
        {
            var testee = new RunningEndpointInstance(
                new SettingsHolder(),
                new FakeBuilder(),
                null,
                new FeatureRunner(new FeatureActivator(new SettingsHolder())),
                new MessageSession(new FakeRootContext()), new FakeTransportInfrastructure());

            await testee.Stop();

            Assert.That(async() => await testee.Stop(), Throws.Nothing);
        }
        static RunningEndpointInstance Create()
        {
            var settings = new SettingsHolder();

            var testInstance = new RunningEndpointInstance(
                settings,
                new HostingComponent(null, true),
                null,
                new FeatureComponent(settings),
                new MessageSession(new FakeRootContext()),
                null);

            return(testInstance);
        }
Exemple #4
0
        public async Task ShouldAllowMultipleStops()
        {
            var settings = new SettingsHolder();

            var testee = new RunningEndpointInstance(
                settings,
                new HostingComponent(null, true),
                null,
                new FeatureComponent(settings),
                new MessageSession(new FakeRootContext()),
                null);

            await testee.Stop();

            Assert.That(async() => await testee.Stop(), Throws.Nothing);
        }
        public async Task<IEndpointInstance> Start()
        {
            DetectThrottlingConfig();

            await transportInfrastructure.Start().ConfigureAwait(false);

            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

            var mainPipeline = new Pipeline<ITransportReceiveContext>(builder, settings, pipelineConfiguration.Modifications);
            var receivers = CreateReceivers(mainPipeline);
            await InitializeReceivers(receivers).ConfigureAwait(false);

            var featureRunner = await StartFeatures(messageSession).ConfigureAwait(false);

            var runningInstance = new RunningEndpointInstance(settings, builder, receivers, featureRunner, messageSession, transportInfrastructure);
            // set the started endpoint on CriticalError to pass the endpoint to the critical error action
            criticalError.SetEndpoint(runningInstance);

            StartReceivers(receivers);

            return runningInstance;
        }