protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); test_suite = Intent.GetStringExtra ("TestSuite"); suite = AndroidRunner.Suites [test_suite]; var menu = new RootElement (String.Empty); main = new Section (test_suite); foreach (ITest test in suite.Tests) { TestSuite ts = test as TestSuite; if (ts != null) main.Add (new TestSuiteElement (ts)); else main.Add (new TestCaseElement (test as TestCase)); } menu.Add (main); Section options = new Section () { new ActionElement ("Run all", Run), }; menu.Add (options); var da = new DialogAdapter (this, menu); var lv = new ListView (this) { Adapter = da }; SetContentView (lv); }
public TestSuiteElement (TestSuite test, TouchRunner runner) : base (test, runner) { Caption = Suite.Name; 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 found inside the assembly"; } }
void Add (TestSuite suite) { AndroidRunner.Suites.Add (suite.FullName ?? suite.Name, suite); foreach (ITest test in suite.Tests) { TestSuite ts = (test as TestSuite); if (ts != null) Add (ts); } }
public TestSuiteElement (TestSuite suite) : base (suite) { if (Suite.TestCaseCount > 0) Indicator = ">"; // hint there's more }
TestSuiteElement Setup (TestSuite suite) { TestSuiteElement tse = new TestSuiteElement (suite, this); suite_elements.Add (suite, tse); var root = new RootElement ("Tests"); Section section = new Section (suite.Name); foreach (ITest test in suite.Tests) { TestSuite ts = (test as TestSuite); if (ts != null) { section.Add (Setup (ts)); } else { TestCase tc = (test as TestCase); if (tc != null) { section.Add (Setup (tc)); } else { throw new NotImplementedException (test.GetType ().ToString ()); } } } root.Add (section); if (section.Count > 1) { Section options = new Section () { new StringElement ("Run all", delegate () { Run (suite); }) }; root.Add (options); } suites_dvc.Add (suite, new DialogViewController (root, true)); return tse; }
public void Show (TestSuite suite) { NavigationController.PushViewController (suites_dvc [suite], true); }
void Run (TestSuite suite) { suite_elements [suite].Run (); }