Exemplo n.º 1
0
        private IRun CreateSequence(Type t)
        {
            SequenceRun seq = new SequenceRun();
            object[] extensions = t.GetCustomAttributes(typeof(TestFixtureExtensionAttribute), true);

            // Before Setup (extensions)
            foreach (TestFixtureExtensionAttribute extension in extensions)
                extension.AddBeforeSetupRuns(seq.Runs);

            // Setup
            seq.Runs.Add(setupRun);

            // Tests
            ParallelRun tests = new ParallelRun();
            seq.Runs.Add(tests);

            foreach (IRun testRun in testRuns)
                tests.Runs.Add(testRun);

            // Tests (extensions)
            foreach (TestFixtureExtensionAttribute extension in extensions)
                extension.AddTestRuns(tests.Runs);

            // TearDown
            seq.Runs.Add(tearDownRun);

            // After TearDown (extensions)
            foreach (TestFixtureExtensionAttribute extension in extensions)
                extension.AddAfterTearDownRuns(seq.Runs);

            return seq;
		}
 public override IRun GetRun()
 {
     var run = new SequenceRun();
     run.Runs.Add(new OptionalMethodRun(typeof (SetUpAttribute), false));
     run.Runs.Add(new MethodRun(typeof (ObservationAttribute), true, true));
     run.Runs.Add(new BlockRun<it>(true,new AppendTestsToTestTree(),run));
     run.Runs.Add(new OptionalMethodRun(typeof (TearDownAttribute), false));
     return run;
 }
        public override IRun GetRun()
        {
            SequenceRun runs = new SequenceRun();

            // setup
            OptionalMethodRun setup = new OptionalMethodRun(typeof(SetUpAttribute),false);
            runs.Runs.Add( setup );

            // tests
            StepMethodRun test = new StepMethodRun();
            runs.Runs.Add(test);

            // tear down
            OptionalMethodRun tearDown = new OptionalMethodRun(typeof(TearDownAttribute),false);
            runs.Runs.Add(tearDown);

            return runs;
        }
Exemplo n.º 4
0
        private IRun CreateSequence(Type t)
        {
            SequenceRun seq = new SequenceRun();

            object[] extensions = t.GetCustomAttributes(typeof(TestFixtureExtensionAttribute), true);

            // Before Setup (extensions)
            foreach (TestFixtureExtensionAttribute extension in extensions)
            {
                extension.AddBeforeSetupRuns(seq.Runs);
            }

            // Setup
            seq.Runs.Add(setupRun);

            // Tests
            ParallelRun tests = new ParallelRun();

            seq.Runs.Add(tests);

            foreach (IRun testRun in testRuns)
            {
                tests.Runs.Add(testRun);
            }

            // Tests (extensions)
            foreach (TestFixtureExtensionAttribute extension in extensions)
            {
                extension.AddTestRuns(tests.Runs);
            }

            // TearDown
            seq.Runs.Add(tearDownRun);

            // After TearDown (extensions)
            foreach (TestFixtureExtensionAttribute extension in extensions)
            {
                extension.AddAfterTearDownRuns(seq.Runs);
            }

            return(seq);
        }
        /// <summary>
        /// Creates the execution logic
        /// </summary>
        /// <remarks>
        /// See summary.
        /// </remarks>
        /// <returns>A <see cref="IRun"/> instance that represent the type
        /// test logic.
        /// </returns>
        /// <include file="MbUnit.Framework.doc.xml" path="doc/examples/example[@name='Indexing']"/>
        public override IRun GetRun()
        {
            SequenceRun runs = new SequenceRun();

            // set up
            OptionalMethodRun setup = new OptionalMethodRun(typeof(SetUpAttribute),false);
            runs.Runs.Add( setup );

            // add tester for the indexing
            IndexerProviderRun indexingTest = new IndexerProviderRun(
                typeof(CollectionIndexingTester)
                );
            runs.Runs.Add( indexingTest );

            // tear down
            OptionalMethodRun tearDown = new OptionalMethodRun(typeof(TearDownAttribute),false);
            runs.Runs.Add(tearDown);

            return runs;
        }
        /// <summary>
        /// Gets the test runner class defining all the test to be run within the tagged fixture class.
        /// </summary>
        /// <returns>A <see cref="SequenceRun"/> object</returns>
        public override IRun GetRun() {

            SequenceRun runs = new SequenceRun();

            // set up
            OptionalMethodRun setup = new OptionalMethodRun(typeof(SetUpAttribute), false);
            runs.Runs.Add(setup);

            // create data
            MethodRun dataProvider = new MethodRun(
                                               typeof(DataProviderAttribute),
                                               typeof(ArgumentFeederRunInvoker),
                                               false,
                                               true
                                               );
            runs.Runs.Add(dataProvider);

            // collection providers	for collection		
            MethodRun copyTo = new MethodRun(
                                               typeof(CopyToProviderAttribute),
                                               typeof(ArgumentFeederRunInvoker),
                                               false,
                                               true
                                               );
            runs.Runs.Add(copyTo);

            // add tester for the order
            CustomRun test = new CustomRun(
                typeof(EnumerationTester),
                typeof(TestAttribute),
                true // it is a test
                );
            runs.Runs.Add(test);


            // tear down
            OptionalMethodRun tearDown = new OptionalMethodRun(typeof(TearDownAttribute), false);
            runs.Runs.Add(tearDown);

            return runs;
        }
        private IRun CreateRun(IFramework framework)
        {
            if (framework == null)
                throw new ArgumentNullException("framework");

            SequenceRun runs = new SequenceRun();

            // SetUp
            OptionalMethodRun setup = new OptionalMethodRun(framework.SetUpAttributeType, false);
            runs.Runs.Add(setup);

            // Test
            FrameworkMethodRun test = new FrameworkMethodRun(framework);
            runs.Runs.Add(test);

            // TearDown
            OptionalMethodRun tearDown = new OptionalMethodRun(framework.TearDownAttributeType, false);
            runs.Runs.Add(tearDown);

            return runs;
        }
        /// <summary>
        /// Gets the test runner class defining all the tests to be run and the test logic to be used within the tagged fixture class.
        /// </summary>
        /// <returns>A <see cref="SequenceRun"/> object</returns>
        public override IRun GetRun() {
            SequenceRun runs = new SequenceRun();

            // process tests
            ProcessMethodRun test = new ProcessMethodRun(typeof(TestSequenceAttribute));
            runs.Runs.Add(test);

            return runs;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Gets the test runner class defining all the tests to be run and the test logic to be used within the tagged fixture class.
        /// </summary>
        /// <returns>A <see cref="SequenceRun"/> object</returns>
        public override IRun GetRun() {
            SequenceRun runs = new SequenceRun();

            // creating parallel
            ParallelRun para = new ParallelRun();
            para.AllowEmpty = false;
            runs.Runs.Add(para);

            // method providers
            MethodRun provider = new MethodRun(
                                               typeof(ProviderAttribute),
                                               typeof(ArgumentFeederRunInvoker),
                                               false,
                                               true
                                               );
            para.Runs.Add(provider);

            // fixture class provider
            FixtureDecoratorRun providerFactory = new FixtureDecoratorRun(
                typeof(ProviderFixtureDecoratorPatternAttribute)
                );
            para.Runs.Add(providerFactory);

            // setup
            OptionalMethodRun setup = new OptionalMethodRun(typeof(SetUpAttribute), false);
            runs.Runs.Add(setup);

            // tests
            MethodRun test = new MethodRun(typeof(TestPatternAttribute), true, true);
            runs.Runs.Add(test);

            // tear down
            OptionalMethodRun tearDown = new OptionalMethodRun(typeof(TearDownAttribute), false);
            runs.Runs.Add(tearDown);

            return runs;
        }
Exemplo n.º 10
0
        private void CreateRun()
        {
            SequenceRun runs = new SequenceRun();

            OptionalNakedMethodRun setUp = new OptionalNakedMethodRun(this.setUpName);
            runs.Runs.Add(setUp);

            NakedMethodRun tests = new NakedMethodRun(this.testNameSuffix);
            runs.Runs.Add(tests);

            OptionalNakedMethodRun tearDown = new OptionalNakedMethodRun(this.tearDownName);
            runs.Runs.Add(tearDown);

            this.run = runs;
        }
        /// <summary>
        /// Creates the run order for the collection
        /// </summary>
        /// <returns>An object derived from <see cref="IRun" /> (a <see cref="SequenceRun" /> object that contains the order of execution</returns>
        public override IRun GetRun() {
            SequenceRun runs = new SequenceRun();

            // set up
            OptionalMethodRun setup = new OptionalMethodRun(typeof(SetUpAttribute), false);
            runs.Runs.Add(setup);

            // collection providers			
            MethodRun provider = new MethodRun(
                                               typeof(ProviderAttribute),
                                               typeof(ArgumentFeederRunInvoker),
                                               false,
                                               true
                                               );
            runs.Runs.Add(provider);


            // fill
            MethodRun fill = new MethodRun(typeof(FillAttribute),
                                           false,
                                           true
                                           );
            runs.Runs.Add(fill);

            // add tester for the order
            CustomRun orderTest = new CustomRun(
                typeof(CollectionOrderTester),
                typeof(TestAttribute),
                true, // it test
                this.order, // constructor arguments
                comparer
                );
            runs.Runs.Add(orderTest);

            // tear down
            OptionalMethodRun tearDown = new OptionalMethodRun(typeof(TearDownAttribute), false);
            runs.Runs.Add(tearDown);


            return runs;
        }
        /// <summary>
        /// Creates the execution logic
        /// </summary>
        /// <remarks>
        /// See summary.
        /// </remarks>
        /// <returns>A <see cref="IRun"/> instance that represent the type
        /// test logic.
        /// </returns>
        public override IRun GetRun()
        {
            SequenceRun runs = new SequenceRun();

            // add setup
            CustomRun setup = new CustomRun(
                this.fixtureType,
                typeof(SetUpAttribute),
                true // it is a test
                );
            setup.FeedSender=false;
            runs.Runs.Add(setup);

            // fixture class provider
            FixtureDecoratorRun providerFactory = new FixtureDecoratorRun(
                typeof(ProviderFixtureDecoratorPatternAttribute)
                );
            runs.Runs.Add(providerFactory);

            // add tester for the order
            CustomRun test = new CustomRun(
                this.fixtureType,
                typeof(TestAttribute),
                true // it is a test
                );
            test.FeedSender=false;
            runs.Runs.Add(test);

            // add tear down
            CustomRun tearDown = new CustomRun(
                this.fixtureType,
                typeof(TearDownAttribute),
                true // it is a test
                );
            tearDown.FeedSender=false;
            runs.Runs.Add(tearDown);

            return runs;
        }