2

I'm using MonoTouch (monoDevelop 2.6) to develop an iPhone app. I've created an iPhone windows based project, a monoTouch library project and a NUnit project. I'll like to add a reference from my NUnit project, to my library project so that I can write some unit tests against my UI agnostic code.

Sadly, the library and UI projects use the runTime MonoForiPhone and can't be added as references to the NUnit project (which uses the Mono/3.5 target framework).. The projects are greyed out under Edit References with a message "Incompatible framework..."

Likewise if I create a regular .net library for my business logic, the UI cannot reference the project.

How can I create units against my iPhone application?

Kye
  • 5,919
  • 10
  • 49
  • 84

3 Answers3

2
  1. Add a monotouch library project which contains non UI code.

  2. Add a nUnit project.

  3. Add files to the nUnit project (by creating links).

Now, I can run the at least one of the tests.

Kye
  • 5,919
  • 10
  • 49
  • 84
0

What I would suggest is to create two projects, one to target MonoTouch and one which targets .NET 3.5/4/whatever for NUnit testing purposes.

jstedfast
  • 35,744
  • 5
  • 97
  • 110
0

In case you missed it, there is now a NUnitLite runner available for MonoTouch which is designed to work for UI agnostic code and executed on devices (or simulator).

See: .NET Unit test runner for iOS

Community
  • 1
  • 1
poupou
  • 43,413
  • 6
  • 77
  • 174