示例#1
0
		public TestCaseElement (TestMethod testCase, TouchRunner runner)
			: base (testCase, runner)
		{
			Caption = testCase.Name;
			Value = "NotExecuted";
			this.Tapped += async delegate {
				if (!Runner.OpenWriter (Test.FullName))
					return;

				var suite = (testCase.Parent as TestSuite);
				var context = TestExecutionContext.CurrentContext;
				context.TestObject = Reflect.Construct (testCase.Method.ReflectedType, null);

				suite.GetOneTimeSetUpCommand ().Execute (context);
				await Run ();
				suite.GetOneTimeTearDownCommand ().Execute (context);

				Runner.CloseWriter ();
				// display more details on (any) failure (but not when ignored)
				if ((TestCase.RunState == RunState.Runnable) && !Result.IsSuccess ()) {
					var root = new RootElement ("Results") {
						new Section () {
							new TestResultElement (Result)
						}
					};
					var dvc = new DialogViewController (root, true) { Autorotate = true };
					runner.NavigationController.PushViewController (dvc, true);
				} else if (GetContainerTableView () != null) {
					var root = GetImmediateRootElement ();
					root.Reload (this, UITableViewRowAnimation.Fade);
				}
			};
		}
示例#2
0
		public TestElement (ITest test, TouchRunner runner)
			: base ("?", "?", UITableViewCellStyle.Subtitle)
		{
			if (test == null)
				throw new ArgumentNullException ("test");
			if (runner == null)
				throw new ArgumentNullException ("runner");
		
			Test = test;
			Runner = runner;
		}
示例#3
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);
            runner = new TouchRunner(window);

            // register every tests included in the main application/assembly
            runner.Add(System.Reflection.Assembly.GetExecutingAssembly());

            window.RootViewController = new UINavigationController(runner.GetViewController());
            window.MakeKeyAndVisible();

            return true;
        }
示例#4
0
        public TestElement(ITest test, TouchRunner runner)
            : base("?", "?", UITableViewCellStyle.Subtitle)
        {
            if (test == null)
            {
                throw new ArgumentNullException("test");
            }
            if (runner == null)
            {
                throw new ArgumentNullException("runner");
            }

            Test   = test;
            Runner = runner;
        }
示例#5
0
		public TestSuiteElement (TestSuite test, TouchRunner runner)
			: base (test, runner)
		{
			Caption = Suite.Name.Split('.').LastOrDefault() ?? "";
			int count = Suite.TestCaseCount;
			if (count > 0) {
				Accessory = UITableViewCellAccessory.DisclosureIndicator;
				DetailColor = DarkGreen;
				Value = String.Format ("{0} test case{1}, {2}", count, count == 1 ? String.Empty : "s", Suite.RunState);
				Tapped += delegate {
					runner.Show (Suite);
				};
			} else {
				DetailColor = UIColor.Orange;
				Value = "No test was found inside this suite";
			}
		}
示例#6
0
        public TestCaseElement(TestMethod testCase, TouchRunner runner)
            : base(testCase, runner)
        {
            Caption      = testCase.Name;
            Value        = "NotExecuted";
            this.Tapped += async delegate {
                if (!Runner.OpenWriter(Test.FullName))
                {
                    return;
                }

                var suite   = (testCase.Parent as TestSuite);
                var context = TestExecutionContext.CurrentContext;
                context.TestObject = Reflect.Construct(testCase.Method.ReflectedType, null);

                suite.GetOneTimeSetUpCommand().Execute(context);
                await Run();

                suite.GetOneTimeTearDownCommand().Execute(context);

                Runner.CloseWriter();
                // display more details on (any) failure (but not when ignored)
                if ((TestCase.RunState == RunState.Runnable) && !Result.IsSuccess())
                {
                    var root = new RootElement("Results")
                    {
                        new Section()
                        {
                            new TestResultElement(Result)
                        }
                    };
                    var dvc = new DialogViewController(root, true)
                    {
                        Autorotate = true
                    };
                    runner.NavigationController.PushViewController(dvc, true);
                }
                else if (GetContainerTableView() != null)
                {
                    var root = GetImmediateRootElement();
                    root.Reload(this, UITableViewRowAnimation.Fade);
                }
            };
        }
        public TestSuiteElement(TestSuite test, TouchRunner runner)
            : base(test, runner)
        {
            Caption = Suite.Name.Split('.').LastOrDefault() ?? "";
            int count = Suite.TestCaseCount;

            if (count > 0)
            {
                Accessory   = UITableViewCellAccessory.DisclosureIndicator;
                DetailColor = DarkGreen;
                Value       = String.Format("{0} test case{1}, {2}", count, count == 1 ? String.Empty : "s", Suite.RunState);
                Tapped     += delegate {
                    runner.Show(Suite);
                };
            }
            else
            {
                DetailColor = UIColor.Orange;
                Value       = "No test was found inside this suite";
            }
        }