예제 #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);
			}
		}
        public void CallWithArgument()
        {
            MethodInfo mi = typeof(HelloWorld).GetMethod("Identity");
            ArgumentFeederRunInvoker invoker = new ArgumentFeederRunInvoker(new MockRun(), mi);
            HelloWorld hw   = new HelloWorld();
            ArrayList  args = new ArrayList();

            args.Add("test");
            Object result = invoker.Execute(hw, args);

            Assert.IsTrue(hw.Executed);
            Assert.AreEqual(2, args.Count);
            Assert.AreEqual(args[0], args[1]);
        }
 public void MethodReturnsVoid()
 {
     MethodInfo mi = typeof(HelloWorld).GetMethod("ReturnsVoid");
     ArgumentFeederRunInvoker invoker =
         new ArgumentFeederRunInvoker(new MockRun(), mi);
 }
 public void MethodNull()
 {
     ArgumentFeederRunInvoker invoker =
         new ArgumentFeederRunInvoker(new MockRun(), null);
 }