This seems relatively simple but I'm not able to find a direct step by step guide anywhere. I have a simple PCL class I've created that is platform independent and I'd like to write a unit test for it. Right now I'm stuck with my test code in an iOS view controller and can only run it by running the app in the simulator. ( Xamarin's documentation isn't that helpful, as they focus on view testing.)
I've added a new project to my solution by using the .NET -> Unit Library Project
template. There's a default test in there called Test where I added a failure:
using NUnit.Framework;
using System;
namespace Tests
{
[TestFixture ()]
public class Test
{
[Test ()]
public void TestCase()
{
Console.WriteLine ("this is a test");
Assert.Fail ("this should fail");
}
}
}
I can't for the life of me figure out how to run this test from within the Xamarin IDE. I'd assume I could right-click on either my new Test project and run the whole thing or right-click on this specific class and run it directly. When I right-click on the Test project, I see the following options:
My Test project structure looks like:
If there's no other option, I would accept an answer that tells me how to run this on the command line.
FWIW, I'm on a Mac running Xamarin Studio 5.9.7 (build 9).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.