20 using System.Collections.Generic;
21 using System.Reflection;
22 using System.Threading;
27 using MonoDroid.Dialog;
28 using NUnit.Framework.Api;
29 using NUnit.Framework.Internal;
30 using SiliconStudio.Paradox.Graphics.Regression;
32 namespace Android.NUnitLite.UI {
40 Initialized = (AndroidRunner.AssemblyLevel.Count > 0);
43 public bool Initialized {
48 get {
return AndroidRunner.Runner; }
51 protected override void OnCreate (Bundle bundle)
53 base.OnCreate (bundle);
57 var runMode =
new Section(
"Run Mode");
58 var interactiveCheckBox =
new CheckboxElement(
"Enable Interactive Mode");
60 runMode.Add(interactiveCheckBox);
63 main =
new Section (
"Test Suites");
65 IList<ITest> suites =
new List<ITest>(AndroidRunner.AssemblyLevel);
66 while (suites.Count == 1 && (suites[0] is TestSuite))
67 suites = suites[0].Tests;
69 foreach (var test
in suites)
71 var ts = test as TestSuite;
85 var lv =
new ListView (
this) {
91 if (Runner.AutoStart) {
92 string msg = String.Format (
"Automatically running tests{0}...",
93 Runner.TerminateAfterExecution ?
" and closing application" : String.Empty);
94 Toast.MakeText (
this, msg, ToastLength.Long).Show ();
95 ThreadPool.QueueUserWorkItem (delegate {
96 RunOnUiThread (delegate {
99 if (Runner.TerminateAfterExecution)
106 NamespaceAssemblyBuilder builder =
new NamespaceAssemblyBuilder(
new NUnitLiteTestAssemblyBuilder());
108 public void Add (Assembly assembly)
110 if (assembly == null)
111 throw new ArgumentNullException (
"assembly");
117 var ts = builder.Build(assembly,
new Dictionary<string, object>());
119 if (ts == null)
return;
122 AndroidRunner.AssemblyLevel.Add (ts);
127 void Add (TestSuite suite)
129 var suiteName = suite.FullName ?? suite.Name;
135 suiteName = (suite.FullName ?? suite.Name) + count;
138 suite.FullName = suite.Name = suiteName;
140 AndroidRunner.Suites.Add(suiteName, suite);
141 foreach (ITest test
in suite.Tests)
143 TestSuite ts = (test as TestSuite);
151 if (!Runner.OpenWriter (
"Run Everything",
this))
155 foreach (TestSuite suite
in AndroidRunner.AssemblyLevel)
157 await Runner.Run(suite);
161 Runner.CloseWriter ();
164 foreach (TestElement te
in main) {
void Add(Assembly assembly)
static bool ForceInteractiveMode
static IDictionary< string, TestSuite > Suites
Sections contain individual Element instances that are rendered by MonoDroid.Dialog ...
override void OnCreate(Bundle bundle)