当前位置: 首页>>代码示例>>C#>>正文


C# Sdk.ExceptionAggregator类代码示例

本文整理汇总了C#中Xunit.Sdk.ExceptionAggregator的典型用法代码示例。如果您正苦于以下问题:C# ExceptionAggregator类的具体用法?C# ExceptionAggregator怎么用?C# ExceptionAggregator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExceptionAggregator类属于Xunit.Sdk命名空间,在下文中一共展示了ExceptionAggregator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScenarioOutlineRunner

 public ScenarioOutlineRunner(
     IMessageSink diagnosticMessageSink,
     IXunitTestCase scenarioOutline,
     string displayName,
     string skipReason,
     object[] constructorArguments,
     IMessageBus messageBus,
     ExceptionAggregator aggregator,
     CancellationTokenSource cancellationTokenSource)
     : base(
         scenarioOutline,
         displayName,
         skipReason,
         constructorArguments,
         noArguments,
         messageBus,
         aggregator,
         cancellationTokenSource)
 {
     this.diagnosticMessageSink = diagnosticMessageSink;
     this.scenarioRunnerFactory = new ScenarioRunnerFactory(
         this.TestCase,
         this.DisplayName,
         this.MessageBus,
         this.TestClass,
         this.ConstructorArguments,
         this.SkipReason,
         this.BeforeAfterAttributes,
         this.Aggregator,
         this.CancellationTokenSource);
 }
开发者ID:thomaslevesque,项目名称:xbehave.net,代码行数:31,代码来源:ScenarioOutlineRunner.cs

示例2: RunTestAsync

 protected override async Task<RunSummary> RunTestAsync()
 {
     var test = new XunitTest(TestCase, DisplayName);
     var aggregator = new ExceptionAggregator(Aggregator);
     var runner = new XunitTestRunner(test, MessageBus, TestClass, ConstructorArguments, TestMethod, TestMethodArguments, SkipReason, BeforeAfterAttributes, aggregator, CancellationTokenSource);
     return await KuduXunitTestRunnerUtils.RunTestAsync(runner, MessageBus, aggregator);
 }
开发者ID:NorimaConsulting,项目名称:kudu,代码行数:7,代码来源:KuduXunitTestCaseRunner.cs

示例3: RunAsync

 public override Task<RunSummary> RunAsync(SpecificationBase specification,
                                  IMessageBus messageBus,
                                  ExceptionAggregator aggregator,
                                  CancellationTokenSource cancellationTokenSource)
 {
     return Task.FromResult(new RunSummary { Total = 1, Skipped = 1  });
 }
开发者ID:D3-LucaPiombino,项目名称:NEventStore,代码行数:7,代码来源:ObservationTestCase.cs

示例4: ScenarioRunner

        public ScenarioRunner(
            IScenario scenario,
            IMessageBus messageBus,
            Type scenarioClass,
            object[] constructorArguments,
            MethodInfo scenarioMethod,
            object[] scenarioMethodArguments,
            string skipReason,
            IReadOnlyList<BeforeAfterTestAttribute> beforeAfterScenarioAttributes,
            ExceptionAggregator aggregator,
            CancellationTokenSource cancellationTokenSource)
        {
            Guard.AgainstNullArgument("scenario", scenario);
            Guard.AgainstNullArgument("messageBus", messageBus);
            Guard.AgainstNullArgument("aggregator", aggregator);

            this.scenario = scenario;
            this.messageBus = messageBus;
            this.scenarioClass = scenarioClass;
            this.constructorArguments = constructorArguments;
            this.scenarioMethod = scenarioMethod;
            this.scenarioMethodArguments = scenarioMethodArguments;
            this.skipReason = skipReason;
            this.beforeAfterScenarioAttributes = beforeAfterScenarioAttributes;
            this.parentAggregator = aggregator;
            this.cancellationTokenSource = cancellationTokenSource;
        }
开发者ID:thomaslevesque,项目名称:xbehave.net,代码行数:27,代码来源:ScenarioRunner.cs

示例5: RunTests

        /// <inheritdoc/>
        protected override bool RunTests(IMessageSink messageSink, object[] constructorArguments, ExceptionAggregator aggregator)
        {
            bool cancelled = false;

            if (!messageSink.OnMessage(new TestStarting { TestCase = this, TestDisplayName = DisplayName }))
                cancelled = true;
            else
            {
                try
                {
                    lambda();

                    if (!messageSink.OnMessage(new TestPassed { TestCase = this, TestDisplayName = DisplayName }))
                        cancelled = true;
                }
                catch (Exception ex)
                {
                    if (!messageSink.OnMessage(new TestFailed(ex) { TestCase = this, TestDisplayName = DisplayName }))
                        cancelled = true;
                }
            }

            if (!messageSink.OnMessage(new TestFinished { TestCase = this, TestDisplayName = DisplayName }))
                cancelled = true;

            return cancelled;
        }
开发者ID:johnkg,项目名称:xunit,代码行数:28,代码来源:LambdaTestCase.cs

示例6: RunTestImpl

        void RunTestImpl(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource, TaskCompletionSource<RunSummary> tcs)
        {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

            var disp = CoreApplication.MainView.Dispatcher;

            // Run on the current window's dispatcher
            disp.RunAsync(CoreDispatcherPriority.Normal,
                          () =>
                          {
                              try
                              {
                                  var result = testCase.RunAsync(diagnosticMessageSink, messageBus, constructorArguments, aggregator, cancellationTokenSource);
                                  result.ContinueWith(t =>
                                  {
                                      if (t.IsFaulted)
                                          tcs.SetException(t.Exception);

                                      tcs.SetResult(t.Result);
                                  });
                              }
                              catch (Exception e)
                              {
                                  tcs.TrySetException(e);
                              }
                          }
                );

#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }
开发者ID:xunit,项目名称:uitest.xunit,代码行数:30,代码来源:UITestCase.RunTest.cs

示例7: RunTestsAsync

        /// <inheritdoc/>
        protected override Task RunTestsAsync(IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
        {
            if (!messageBus.QueueMessage(new TestStarting(this, DisplayName)))
                cancellationTokenSource.Cancel();
            else
            {
                try
                {
                    lambda();

                    if (!messageBus.QueueMessage(new TestPassed(this, DisplayName, 0, null)))
                        cancellationTokenSource.Cancel();
                }
                catch (Exception ex)
                {
                    if (!messageBus.QueueMessage(new TestFailed(this, DisplayName, 0, null, ex)))
                        cancellationTokenSource.Cancel();
                }
            }

            if (!messageBus.QueueMessage(new TestFinished(this, DisplayName, 0, null)))
                cancellationTokenSource.Cancel();

            return Task.FromResult(0);
        }
开发者ID:PKRoma,项目名称:xunit-codeplex,代码行数:26,代码来源:LambdaTestCase.cs

示例8: RunAsync

        public Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
        {
            
            var tcs = new TaskCompletionSource<RunSummary>();



#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed


            // Run on the UI thread
            Device.BeginInvokeOnMainThread(
                () =>
                {
                    try
                    {
                        var result = testCase.RunAsync(diagnosticMessageSink, messageBus, constructorArguments, aggregator, cancellationTokenSource);
                        result.ContinueWith(t =>
                                            {
                                                if (t.IsFaulted)
                                                    tcs.SetException(t.Exception);

                                                tcs.SetResult(t.Result);
                                            });
                    }
                    catch (Exception e)
                    {
                        tcs.SetException(e);
                    }

                });
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

            return tcs.Task;
        }
开发者ID:robertbaker,项目名称:devices.xunit,代码行数:35,代码来源:UITestCase.cs

示例9: RunAsync

 /// <inheritdoc/>
 public override Task<RunSummary> RunAsync(IMessageBus messageBus,
                                           object[] constructorArguments,
                                           ExceptionAggregator aggregator,
                                           CancellationTokenSource cancellationTokenSource)
 {
     return new LambdaTestCaseRunner(this, messageBus, aggregator, cancellationTokenSource).RunAsync();
 }
开发者ID:ansarisamer,项目名称:xunit,代码行数:8,代码来源:LambdaTestCase.cs

示例10: RunAsync

        public Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
        {
            var tcs = new TaskCompletionSource<RunSummary>();

            RunTestImpl(diagnosticMessageSink, messageBus, constructorArguments, aggregator, cancellationTokenSource, tcs);

            return tcs.Task;
        }
开发者ID:xunit,项目名称:uitest.xunit,代码行数:8,代码来源:UITestCase.cs

示例11: FactDiscovererTests

 public FactDiscovererTests()
 {
     aggregator = new ExceptionAggregator();
     cancellationTokenSource = new CancellationTokenSource();
     factAttribute = Mocks.FactAttribute();
     messageBus = new SpyMessageBus();
     options = TestFrameworkOptions.ForDiscovery();
 }
开发者ID:Xarlot,项目名称:xunit,代码行数:8,代码来源:FactDiscovererTests.cs

示例12: RunAsync

 /// <inheritdoc />
 public override Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink,
                                           IMessageBus messageBus,
                                           object[] constructorArguments,
                                           ExceptionAggregator aggregator,
                                           CancellationTokenSource cancellationTokenSource)
 {
     return new XunitTheoryTestCaseRunner(this, DisplayName, SkipReason, constructorArguments, diagnosticMessageSink, messageBus, aggregator, cancellationTokenSource).RunAsync();
 }
开发者ID:commonsensesoftware,项目名称:xunit,代码行数:9,代码来源:XunitTheoryTestCase.cs

示例13: XunitTheoryTestCaseRunner

 /// <summary>
 /// Initializes a new instance of the <see cref="XunitTheoryTestCaseRunner"/> class.
 /// </summary>
 /// <param name="testCase">The test case to be run.</param>
 /// <param name="displayName">The display name of the test case.</param>
 /// <param name="skipReason">The skip reason, if the test is to be skipped.</param>
 /// <param name="constructorArguments">The arguments to be passed to the test class constructor.</param>
 /// <param name="messageBus">The message bus to report run status to.</param>
 /// <param name="aggregator">The exception aggregator used to run code and collect exceptions.</param>
 /// <param name="cancellationTokenSource">The task cancellation token source, used to cancel the test run.</param>
 public XunitTheoryTestCaseRunner(IXunitTestCase testCase,
                                  string displayName,
                                  string skipReason,
                                  object[] constructorArguments,
                                  IMessageBus messageBus,
                                  ExceptionAggregator aggregator,
                                  CancellationTokenSource cancellationTokenSource)
     : base(testCase, displayName, skipReason, constructorArguments, NoArguments, messageBus, aggregator, cancellationTokenSource) { }
开发者ID:Tofudebeast,项目名称:xunit,代码行数:18,代码来源:XunitTheoryTestCaseRunner.cs

示例14: RunAsync

 /// <inheritdoc />
 public override async Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
 {
     var messageBusInterceptor = new SkippableTestMessageBus(messageBus, this.SkippingExceptionNames);
     var result = await base.RunAsync(diagnosticMessageSink, messageBusInterceptor, constructorArguments, aggregator, cancellationTokenSource);
     result.Failed -= messageBusInterceptor.SkippedCount;
     result.Skipped += messageBusInterceptor.SkippedCount;
     return result;
 }
开发者ID:AArnott,项目名称:Xunit.SkippableFact,代码行数:9,代码来源:SkippableFactDiscoverer.cs

示例15: RunAsync

        public override Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
        {
            var sta = StaTaskScheduler.DefaultSta;
            var task = Task.Factory.StartNew(async () =>
            {
                Debug.Assert(sta.Threads.Length == 1);
                Debug.Assert(sta.Threads[0] == Thread.CurrentThread);

                using (await _wpfTestSerializationGate.DisposableWaitAsync())
                {
                    try
                    {
                        // Sync up FTAO to the context that we are creating here. 
                        ForegroundThreadAffinitizedObject.CurrentForegroundThreadData = new ForegroundThreadData(
                            Thread.CurrentThread,
                            StaTaskScheduler.DefaultSta,
                            ForegroundThreadDataKind.StaUnitTest);

                        // All WPF Tests need a DispatcherSynchronizationContext and we dont want to block pending keyboard
                        // or mouse input from the user. So use background priority which is a single level below user input.
                        var dispatcherSynchronizationContext = new DispatcherSynchronizationContext();

                        // xUnit creates its own synchronization context and wraps any existing context so that messages are
                        // still pumped as necessary. So we are safe setting it here, where we are not safe setting it in test.
                        SynchronizationContext.SetSynchronizationContext(dispatcherSynchronizationContext);

                        // Just call back into the normal xUnit dispatch process now that we are on an STA Thread with no synchronization context.
                        var baseTask = base.RunAsync(diagnosticMessageSink, messageBus, constructorArguments, aggregator, cancellationTokenSource);
                        do
                        {
                            var delay = Task.Delay(TimeSpan.FromMilliseconds(10), cancellationTokenSource.Token);
                            var completed = await Task.WhenAny(baseTask, delay).ConfigureAwait(false);
                            if (completed == baseTask)
                            {
                                return await baseTask.ConfigureAwait(false);
                            }

                            // Schedule a task to pump messages on the UI thread.  
                            await Task.Factory.StartNew(
                                () => WaitHelper.WaitForDispatchedOperationsToComplete(DispatcherPriority.ApplicationIdle),
                                cancellationTokenSource.Token,
                                TaskCreationOptions.None,
                                sta).ConfigureAwait(false);
                        }
                        while (true);
                    }
                    finally
                    {
                        ForegroundThreadAffinitizedObject.CurrentForegroundThreadData = null;

                        // Cleanup the synchronization context even if the test is failing exceptionally
                        SynchronizationContext.SetSynchronizationContext(null);
                    }
                }
            }, cancellationTokenSource.Token, TaskCreationOptions.None, sta);

            return task.Unwrap();
        }
开发者ID:jeffanders,项目名称:roslyn,代码行数:58,代码来源:WpfTestCase.cs


注:本文中的Xunit.Sdk.ExceptionAggregator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。