예제 #1
0
        public Task <TestResult> Run(NUnit.Framework.Internal.Test test)
        {
            return(Task.Run(() =>
            {
                TestExecutionContext current = TestExecutionContext.CurrentContext;
                current.WorkDirectory = Environment.CurrentDirectory;
                //current.Listener = this; // Internal on Android
                current.GetType().GetField("listener", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(current, this);
                current.TestObject = test is TestSuite ? null : Reflect.Construct((test as TestMethod).Method.ReflectedType, null);
                WorkItem wi = test.CreateWorkItem(TestFilter.Empty);

                wi.Execute(current);
                return wi.Result;
            }));
        }
예제 #2
0
        public TestResult Run(NUnit.Framework.Internal.Test test)
        {
            TestExecutionContext current = TestExecutionContext.CurrentContext;

            current.WorkDirectory = System.Environment.CurrentDirectory;
            current.Listener      = this;
            current.TestObject    = test is TestSuite ? null : Reflect.Construct((test as TestMethod).Method.ReflectedType, null);
            WorkItem wi = test.CreateWorkItem(Filter ?? TestFilter.Empty);

            if (test is TestMethod)
            {
                (test.Parent as TestSuite).GetOneTimeSetUpCommand().Execute(current);
            }
            wi.Execute(current);
            if (test is TestMethod)
            {
                (test.Parent as TestSuite).GetOneTimeTearDownCommand().Execute(current);
            }
            return(wi.Result);
        }
예제 #3
0
		public Task<TestResult> Run (Test test)
		{
		    return Task.Run(() =>
		    {
		        Result = null;
		        TestExecutionContext current = TestExecutionContext.CurrentContext;
		        current.WorkDirectory = Environment.CurrentDirectory;
		        //current.Listener = this; // Internal on Android
		        current.GetType().GetField("listener", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(current, this);
                current.TestObject = test is TestSuite ? null : Reflect.Construct((test as TestMethod).Method.ReflectedType, null);
		        WorkItem wi = test.CreateWorkItem(filter);
		        wi.Execute(current);
		        Result = wi.Result;
		        return Result;
		    });
		}
예제 #4
0
		public TestResult Run (Test test)
		{
			PassedCount = 0;
			IgnoredCount = 0;
			FailedCount = 0;
			InconclusiveCount = 0;

			Result = null;
			TestExecutionContext current = TestExecutionContext.CurrentContext;
			current.WorkDirectory = Environment.CurrentDirectory;
			current.Listener = this;
			WorkItem wi = test.CreateWorkItem (filter, new FinallyDelegate ());
			wi.Execute (current);
			Result = wi.Result;
			return Result;
		}
예제 #5
0
		public TestResult Run (Test test)
		{
			Result = null;
			TestExecutionContext current = TestExecutionContext.CurrentContext;
			current.WorkDirectory = Environment.CurrentDirectory;
			current.Listener = this;
			WorkItem wi = test.CreateWorkItem (filter);
			wi.Execute (current);
			Result = wi.Result;
			return Result;
		}
예제 #6
0
        public static ITestResult RunTest(Test test, object testObject)
        {
            TestExecutionContext context = new TestExecutionContext();
            context.TestObject = testObject;

            WorkItem work = test.CreateWorkItem(TestFilter.Empty);
            return ExecuteAndWaitForResult(work, context);
        }
예제 #7
0
        public static WorkItem RunTestAsync(Test test, object testObject)
        {
            TestExecutionContext context = new TestExecutionContext();
            context.TestObject = testObject;

            WorkItem work = test.CreateWorkItem(TestFilter.Empty);
            work.Execute(context);

            return work;
        }