I\'m on a Mac, running .NET Core 1.0 and Visual Studio Code.
I have a console project and a test project. I have setup launch.json so that I can debug the console pr
Tyler's answer of clicking the debug test
code lens icons is the easiest way of debugging a single test.
A way of testing all unit tests would be to add while(!Debugger.IsAttached) Thread.Sleep(500);
inside the tests. This will make the tests wait until you attach a debugger.
using System;
using System.Diagnostics;
using System.Threading;
using NUnit.Framework;
namespace SomeNamespace
{
[TestFixture]
public class SomeClassTests
{
[Test]
public void ShouldDoTest()
{
while(!Debugger.IsAttached) Thread.Sleep(500);
Assert.That(true, Is.True);
}
[Test]
public void ShouldDoTest2()
{
while(!Debugger.IsAttached) Thread.Sleep(500);
Assert.That(true, Is.True);
}
}
}
This then allows you to attach the Visual Studio Code debugger to the running testhost.dll. Simple select .NET Core Attach
and then the dotnet testhost.dll
.