Inheritance: System.MarshalByRefObject
コード例 #1
0
ファイル: ScenarioRunner.cs プロジェクト: matucs/NServiceBus
        static async Task ExecuteWhens(EndpointRunner endpoint, CancellationTokenSource cts)
        {
            var token = cts.Token;

            try
            {
                await endpoint.Whens(token).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                cts.Cancel();
                throw new ScenarioException("Whens failed to execute", ex);
            }
        }
コード例 #2
0
ファイル: ScenarioRunner.cs プロジェクト: matucs/NServiceBus
        static async Task StartEndpoint(EndpointRunner endpoint, CancellationTokenSource cts)
        {
            var token = cts.Token;

            try
            {
                await endpoint.Start(token).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                cts.Cancel();
                throw new ScenarioException("Endpoint failed to start", ex);
            }
        }
コード例 #3
0
ファイル: ScenarioRunner.cs プロジェクト: vvsvvt/NServiceBus
        static async Task ExecuteWhens(EndpointRunner endpoint, CancellationTokenSource cts)
        {
            var token = cts.Token;

            try
            {
                await endpoint.Whens(token).ConfigureAwait(false);
            }
            catch (Exception)
            {
                cts.Cancel();
                Console.WriteLine($"Whens for endpoint {endpoint.Name()} failed to execute.");
                throw;
            }
        }
コード例 #4
0
ファイル: ScenarioRunner.cs プロジェクト: vvsvvt/NServiceBus
        static async Task StartEndpoint(EndpointRunner endpoint, CancellationTokenSource cts)
        {
            var token = cts.Token;

            try
            {
                await endpoint.Start(token).ConfigureAwait(false);
            }
            catch (Exception)
            {
                cts.Cancel();
                Console.WriteLine($"Endpoint {endpoint.Name()} failed to start.");
                throw;
            }
        }
コード例 #5
0
        public async Task <ComponentRunner> CreateRunner(RunDescriptor run)
        {
            var endpointName = Conventions.EndpointNamingConvention(EndpointBuilder.GetType());

            var runner = new EndpointRunner(createInstanceCallback, startInstanceCallback, DoNotFailOnErrorMessages);

            try
            {
                await runner.Initialize(run, this, endpointName).ConfigureAwait(false);
            }
            catch (Exception)
            {
                TestContext.WriteLine($"Endpoint {runner.Name} failed to initialize");
                throw;
            }
            return(runner);
        }
コード例 #6
0
        public async Task <ComponentRunner> CreateRunner(RunDescriptor run)
        {
            var endpointName = Conventions.EndpointNamingConvention(EndpointBuilderType);

            if (endpointName.Length > 77)
            {
                throw new Exception($"Endpoint name '{endpointName}' is larger than 77 characters and will cause issues with MSMQ queue names. Rename the test class or endpoint.");
            }

            var runner = new EndpointRunner(DoNotFailOnErrorMessages);

            try
            {
                await runner.Initialize(run, this, endpointName).ConfigureAwait(false);
            }
            catch (Exception)
            {
                TestContext.WriteLine($"Endpoint {runner.Name} failed to initialize");
                throw;
            }
            return(runner);
        }
コード例 #7
0
        static async Task <EndpointRunner[]> InitializeRunners(RunDescriptor runDescriptor, List <EndpointBehavior> endpointBehaviors)
        {
            var runnerInitializations = endpointBehaviors.Select(async endpointBehavior =>
            {
                var endpointName = Conventions.EndpointNamingConvention(endpointBehavior.EndpointBuilderType);

                if (endpointName.Length > 77)
                {
                    throw new Exception($"Endpoint name '{endpointName}' is larger than 77 characters and will cause issues with MSMQ queue names. Rename the test class or endpoint.");
                }

                var runner = new EndpointRunner();

                try
                {
                    await runner.Initialize(runDescriptor, endpointBehavior, endpointName).ConfigureAwait(false);
                }
                catch (Exception)
                {
                    Console.WriteLine($"Endpoint {runner.Name()} failed to initialize");
                    throw;
                }

                return(runner);
            });

            try
            {
                var x = await Task.WhenAll(runnerInitializations).ConfigureAwait(false);

                return(x);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
コード例 #8
0
 static async Task ExecuteWhens(EndpointRunner endpoint, CancellationTokenSource cts)
 {
     var token = cts.Token;
     try
     {
         await endpoint.Whens(token).ConfigureAwait(false);
     }
     catch (Exception)
     {
         cts.Cancel();
         Console.WriteLine($"Whens for endpoint {endpoint.Name()} failed to execute.");
         throw;
     }
 }
コード例 #9
0
 static async Task StartEndpoint(EndpointRunner endpoint, CancellationTokenSource cts)
 {
     var token = cts.Token;
     try
     {
         await endpoint.Start(token).ConfigureAwait(false);
     }
     catch (Exception)
     {
         cts.Cancel();
         Console.WriteLine($"Endpoint {endpoint.Name()} failed to start.");
         throw;
     }
 }