Unit Testing Framework for MonoDroid

Currently MonoDroid (or “Mono for Android”) is lacking a unit testing framework. Since Xamarin (the guys behind MonoDroid) enable us to use C# on almost every platform it would be nice to be able to reuse C# unit tests written for Visual Studio on other platforms, such as Android.

This is the goal behind the MonoDroid Unit Testing Framework which can be obtained here:

https://bitbucket.org/mayastudios/monodroid-unittest/

Happy testing!

Overview over all testsDetails about one test method

Creating an Application class in Mono for Android

Android provides an Application class.

Base class for those who need to maintain global application state.

Here’s how to create such a class in Mono for Android:

[Application]  // <-- Attribute required
class MyApp : Application {
  // Required constructor
  public MyApp(IntPtr javaReference, JniHandleOwnership transfer) 
    : base(javaReference, transfer) { }

  // Test method - not required
  public override void OnCreate() {
    base.OnCreate();
  }
}

Note: There can only be one such class in an Android application.