Пример #1
0
		/// <summary>
		/// Populates the <see cref="RunInvokerTree"/> invoker graph
		/// with <see cref="IRunInvoker"/> generated by the run.
		/// </summary>
		/// <param name="tree">Invoker tree</param>
		/// <param name="parent">parent vertex</param>
		/// <param name="t">class type that is marked by the run</param>
		/// <remarks>
		/// </remarks>
		public void Reflect(RunInvokerTree tree, RunInvokerVertex parent, Type t)
		{
			foreach(MethodInfo mi in 
				TypeHelper.GetAttributedMethods(t,typeof(IndexerProviderAttribute)))
			{
				// get attribute
				IndexerProviderAttribute attr = 
					(IndexerProviderAttribute)TypeHelper.GetFirstCustomAttribute(mi,typeof(IndexerProviderAttribute));
				
				// add indexer provider
				IRunInvoker invoker = 
					new ArgumentFeederRunInvoker(this,mi);
				RunInvokerVertex child = 
						tree.AddChild(parent,invoker);				
				
				// add tester
				CustomRun testerRun = new CustomRun(
					this.testerType,
					typeof(TestAttribute),
					true,
					attr
					);
				testerRun.Reflect(tree,child,t);
			}
		}
        /// <summary>
        /// </summary>		
        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;
        }
        /// <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;
        }
        /// <summary>
        /// Populates the <see cref="RunInvokerTree"/> invoker graph
        /// with <see cref="IRunInvoker"/> generated by the run.
        /// </summary>
        /// <param name="tree">Invoker tree</param>
        /// <param name="parent">parent vertex</param>
        /// <param name="t">class type that is marked by the run</param>
        /// <remarks>
        /// </remarks>
        public void Reflect(RunInvokerTree tree, RunInvokerVertex parent, Type t)
        {
            foreach(MethodInfo mi in
                TypeHelper.GetAttributedMethods(t,typeof(IndexerProviderAttribute)))
            {
                // get attribute
                IndexerProviderAttribute attr =
                    (IndexerProviderAttribute)TypeHelper.GetFirstCustomAttribute(mi,typeof(IndexerProviderAttribute));

                // add indexer provider
                IRunInvoker invoker =
                    new ArgumentFeederRunInvoker(this,mi);
                RunInvokerVertex child =
                        tree.AddChild(parent,invoker);

                // add tester
                CustomRun testerRun = new CustomRun(
                    this.testerType,
                    typeof(TestAttribute),
                    true,
                    attr
                    );
                testerRun.Reflect(tree,child,t);
            }
        }