Testing a Monotouch Application Using NUnit in MonoDevelop 2.4

I am new to Monotouch and Monodevelop. Trying to get started with NUnit, and I have a lot of problems - none of the thumbnails that I can find on the line seem to match what I see in the user interface (MonoDevelop 2.4 on Mac OS 10.6). I tried:

  • Adding a NUnit assembly test collection project to my solution.
  • Adding the “Empty MonoTouch Project” project to my solution, and then adding NUnit assemblies to it and adding my main project as a reference.
  • Adding C # "Empty Project" to my solution and adding NUnit, MonoTouch and my own project as links. This results in a build error that says "[project project name] .exe" does not contain a static "Basic" method suitable for the entry point.

(1) creates a strange project to which I can only add assemblies - no links and, of course, no tests.

(2) and (3) behave quite accurately:

  • Firstly, a build error complaining about the lack of a static "Main" method. I can fix this by changing the compilation target to "Library" in the project settings Build -> General.
  • Then, when I try to run the tests (from the Unit Testing tab), he says that he runs them using the "Debug | iPhoneSimulator" configuration.
  • " " "running tests", .
  • ": 0 : 0 : 0".

, - , ?

, .

using System;
using NUnit.Framework;
namespace mynamespace
{ 
    [TestFixture]
    public class NavItemTest
    {
        [Test]
        public void TestAll()
        {
           Assert.AreEqual(4, NavItem.all().Count);
        }
    }
}
+3
3

, MonoTouch NUnitLite, UI ( ).

: .NET Unit test iOS

+1

, . : http://ben.phegan.name/index.php/2011/02/28/monotouch-and-unit-testing. .

:

  • NUnit
  • MonoTouch
  • , , monotouch.dll( ).
  • Win!
+1

:

, , "[ ].exe" "" , .

, Project → [Project name] Options → Build General. . Main-method, , , ; .

0
source

Source: https://habr.com/ru/post/1768143/


All Articles