This standalone runner works with a Nunit project.
First, this runner installs all dependencies using nuget install in /project/packages. Dependencies must be specified in the packages.config file at the project root. It will install the NUnit-ConsoleRunner package too. In order to be valid, the 'HintPath' for your dependencies should be ../packages, which is the default value.
At each play, it copies the user's answer and builds the project. It then runs the provided testcase using NUnit with a --where "$@" filter.
The filter syntax can be found here: https://github.com/nunit/docs/wiki/Test-Selection-Language
To use this runner for your project, edit the techio.yml file and add the following lines to your project:
runner: techio/mono-nuget-nunit-runner:1.2.0-mono-4.8A Git Course Example
.
├── about.md
├── techio.yml
├── markdowns
│ └── <YOUR_LESSONS>.md
└── projects
└── example #Your project root
├── Example.cs #Your UnitTest Class
├── Example.csproj
├── Exercises
│ ├── Exercise1.cs #The stub provided to the user
│ └── <MORE_EXERCISES>.cs
└── packages.config
In your CS project:
CourseExample.cs
using Answer;
using NUnit.Framework;
using System;
namespace CourseExample
{
[TestFixture ()]
public class CourseExample
{
[Test]
public void VerifySum() {
Assert.AreEqual (0, Exercise1.DoSum (0, 0));
/* [...] */
}
}
}Exercise1.cs
using System;
namespace Anwser
{
public class Exercise1 {
/**
* This function should return the sum between a and b
**/
public static int DoSum(int a, int b){
return 1;
}
}
}In your lesson:
@[Fix the following code so that the function DoSum returns a sum of integer]({"stubs": ["Exercises/Exercise1.cs"],"command": "'name == VerifySum'"})| Technology | Version |
|---|---|
| Mono | 4.8.0 |
| Nuget | lastest |
| Nunit | lastest |