protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
if (Runner.Options == null)
Runner.Options = new Options (this);
var menu = new RootElement ("Test Runner");
main = new Section ("Test Suites");
foreach (TestSuite suite in AndroidRunner.AssemblyLevel) {
main.Add (new TestSuiteElement (suite, Runner));
}
menu.Add (main);
Section options = new Section () {
new ActionElement ("Run Everything", Run),
new ActivityElement ("Options", typeof (OptionsActivity)),
new ActivityElement ("Credits", typeof (CreditsActivity))
};
menu.Add (options);
var lv = new ListView (this) {
Adapter = new DialogAdapter (this, menu)
};
SetContentView (lv);
// AutoStart running the tests (with either the supplied 'writer' or the options)
if (Runner.AutoStart) {
string msg = String.Format ("Automatically running tests{0}...",
Runner.TerminateAfterExecution ? " and closing application" : String.Empty);
Toast.MakeText (this, msg, ToastLength.Long).Show ();
ThreadPool.QueueUserWorkItem (delegate {
RunOnUiThread (delegate {
Run ();
// optionally end the process, e.g. click "Andr.Unit" -> log tests results, return to springboard...
if (Runner.TerminateAfterExecution)
Finish ();
});
});
}
}