Example #1
0
        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);
        }
Example #2
0
        /// <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>
        /// 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);
        }
Example #4
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);
        }
Example #5
0
        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);
        }
Example #6
0
        /// <summary>
        /// Creates the execution logic
        /// </summary>
        /// <remarks>
        /// See summary.
        /// </remarks>
        /// <returns>A <see cref="IRun"/> instance that represent the type
        /// test logic.
        /// </returns>
        /// <example name="Indexing">
        /// <para>
        /// This example checks the Collection Indexing Pattern for the <see cref="ArrayList"/>
        /// and <see cref="Array"/> collections:
        /// </para>
        /// <code>
        /// [CollectionIndexingFixture]
        /// public class CollectionIndexingFixtureAttributeTest
        /// {
        ///     [IntIndexerProvider(typeof(ArrayList),100)]
        ///    public ArrayList ProvideArrayList100()
        ///     {
        ///         ArrayList list = new ArrayList();
        ///         for(int i =0;i &lt; 100;++i)
        ///             list.Add(i);
        ///
        ///         return list;
        ///     }
        ///
        ///     [IntIndexerProvider(typeof(Array),10)]
        ///     public ArrayList ProvideArrayList()
        ///     {
        ///         ArrayList list = new ArrayList();
        ///         for(int i=0;i &lt; 10;++i)
        ///            list.Add(i);
        ///
        ///         return list;
        ///     }
        /// }
        /// </code>
        /// </example>
        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);
        }