Exemple #1
0
        public void Run_should_report_all_results_excluding_the_test_that_exception_occurs_in_the_callback()
        {
            // Arrange
            var configuration = Configuration.Create().WithNumberOfIterations(200).
                                WithMaxSchedulingSteps(10).
                                WithParallelBugFindingTasks(5).
                                WithRandomSchedulingSeed();
            var engine = new CompositeBugFindingEngine(configuration, runtimeHost =>
            {
                var m1 = runtimeHost.New(MachineInterface.Sender <M1.ISender>().Bundler <M1.IBundler>().Receiver <M1.InfiniteLoopReceiver>());
                m1.Configure(new Notify());
            });

            engine.RegisterPerIterationCallBacks(new Action <int>[]
            {
                iteration => { },
                iteration => { },
                iteration => { throw new NotSupportedException(); },
                iteration => { },
                iteration => { },
            });


            // Act, Assert
            var ex = Assert.Throws <AggregateException>(() => engine.Run());

            Assert.IsInstanceOf <TargetInvocationException>(ex.GetBaseException());
            Assert.IsInstanceOf <NotSupportedException>(ex.GetBaseException().InnerException);
            Assert.IsNotNull(engine.TestReports[0]);
            Assert.IsNotNull(engine.TestReports[1]);
            Assert.IsNull(engine.TestReports[2]);
            Assert.IsNotNull(engine.TestReports[3]);
            Assert.IsNotNull(engine.TestReports[4]);
        }
Exemple #2
0
        public void RegisterPerIterationCallBacks_should_throw_ArgumentOutOfRangeException_if_specifying_the_number_of_callbacks_different_from_the_number_of_parallel_tasks()
        {
            // Arrange
            var configuration = Configuration.Create().WithParallelBugFindingTasks(5);
            var engine        = new CompositeBugFindingEngine(configuration, runtimeHost =>
            {
                var m1 = runtimeHost.New(MachineInterface.Sender <M1.ISender>().Bundler <M1.IBundler>().Receiver <M1.InfiniteLoopReceiver>());
                m1.Configure(new Notify());
            });


            // Act, Assert
            var ex = Assert.Throws <ArgumentOutOfRangeException>(() => engine.RegisterPerIterationCallBacks(new Action <int>[]
            {
                iteration => { },
                iteration => { },
                iteration => { },
                iteration => { },
            }));;

            Assert.That(ex.Message, Does.Match(@"Specified argument length was out of the range of valid length \d+\."));
        }