|
1 | | -# mono-nuget-nunit-runner |
| 1 | +# mono-nuget-nunit-runner |
| 2 | + |
| 3 | +This standalone runner works with a Nunit project. |
| 4 | + |
| 5 | +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. |
| 6 | + |
| 7 | +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. |
| 8 | + |
| 9 | +The filter syntax can be found here: [https://github.com/nunit/docs/wiki/Test-Selection-Language](https://github.com/nunit/docs/wiki/Test-Selection-Language) |
| 10 | + |
| 11 | +# How to Use |
| 12 | + |
| 13 | +To use this runner for your project, edit the `codingame.yml` file and add the following lines to your project: |
| 14 | + |
| 15 | +```yaml |
| 16 | + runner: |
| 17 | + name: codingame/mono-nuget-nunit-runner |
| 18 | + version: 1.0.0-mono-4.8 |
| 19 | +``` |
| 20 | +
|
| 21 | +## Example |
| 22 | +
|
| 23 | +**A Git Course Example** |
| 24 | +
|
| 25 | +``` |
| 26 | +. |
| 27 | +├── about.md |
| 28 | +├── codingame.yml |
| 29 | +├── markdowns |
| 30 | +│ └── <YOUR_LESSONS>.md |
| 31 | +└── projects |
| 32 | + └── example #Your project root |
| 33 | + ├── Example.cs #Your UnitTest Class |
| 34 | + ├── Example.csproj |
| 35 | + ├── Exercises |
| 36 | + │ ├── Exercise1.cs #The stub provided to the user |
| 37 | + │ └── <MORE_EXERCISES>.cs |
| 38 | + └── packages.config |
| 39 | +``` |
| 40 | + |
| 41 | +**In your CS project:** |
| 42 | + |
| 43 | +*CourseExample.cs* |
| 44 | +```cs |
| 45 | +using Answer; |
| 46 | +using NUnit.Framework; |
| 47 | +using System; |
| 48 | + |
| 49 | +namespace CourseExample |
| 50 | +{ |
| 51 | + [TestFixture ()] |
| 52 | + public class CourseExample |
| 53 | + { |
| 54 | + [Test] |
| 55 | + public void VerifySum() { |
| 56 | + Assert.AreEqual (0, Exercise1.DoSum (0, 0)); |
| 57 | + /* [...] */ |
| 58 | + } |
| 59 | + } |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +*Exercise1.cs* |
| 64 | +```cs |
| 65 | +using System; |
| 66 | +namespace Anwser |
| 67 | +{ |
| 68 | + public class Exercise1 { |
| 69 | + /** |
| 70 | + * This function should return the sum between a and b |
| 71 | + **/ |
| 72 | + public static int DoSum(int a, int b){ |
| 73 | + return 1; |
| 74 | + } |
| 75 | + } |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +**In your lesson:** |
| 80 | +```md |
| 81 | +@[Fix the following code so that the function DoSum returns a sum of integer]({"stubs": ["Exercises/Exercise1.cs"],"command": "'name == VerifySum'"}) |
| 82 | +``` |
| 83 | + |
| 84 | +# Technologies |
| 85 | + |
| 86 | +| Technology | Version | |
| 87 | +| ------------- | --------------- | |
| 88 | +| **Mono** | [4.8.0](http://www.mono-project.com/docs/about-mono/releases/4.8.0) | |
| 89 | +| **Nuget** | lastest | |
| 90 | +| **Nunit** | [lastest](https://github.com/nunit/docs/wiki/NUnit-Documentation) | |
0 commit comments