diff --git a/src/Exercism.TestRunner.CSharp/TestResultParser.cs b/src/Exercism.TestRunner.CSharp/TestResultParser.cs
index b2072dc..e9befb6 100644
--- a/src/Exercism.TestRunner.CSharp/TestResultParser.cs
+++ b/src/Exercism.TestRunner.CSharp/TestResultParser.cs
@@ -50,6 +50,7 @@ private static TestResult ToTestResult(XmlUnitTestResult xmlUnitTestResult, Meth
Status = xmlUnitTestResult.Status(),
Message = xmlUnitTestResult.Message(),
Output = xmlUnitTestResult.Output(),
+ TaskId = testMethodDeclaration.TaskId(),
TestCode = testMethodDeclaration.TestCode()
};
@@ -94,6 +95,18 @@ private static string TestCode(this MethodDeclarationSyntax testMethod)
.WithoutLeadingTrivia()
.ToString();
}
+
+ private static int? TaskId(this MethodDeclarationSyntax testMethod) =>
+ testMethod.AttributeLists
+ .SelectMany(attributeList => attributeList.Attributes)
+ .Where(attribute =>
+ attribute.Name.ToString() == "Task" &&
+ attribute.ArgumentList != null &&
+ attribute.ArgumentList.Arguments.Count == 1 &&
+ attribute.ArgumentList.Arguments[0].Expression.IsKind(SyntaxKind.NumericLiteralExpression))
+ .Select(attribute => (LiteralExpressionSyntax)attribute.ArgumentList.Arguments[0].Expression)
+ .Select(taskNumberExpression => (int?)taskNumberExpression.Token.Value!)
+ .FirstOrDefault();
}
[XmlRoot(ElementName = "Output", Namespace = "http://microsoft.com/schemas/VisualStudio/TeamTest/2010")]
diff --git a/src/Exercism.TestRunner.CSharp/TestRun.cs b/src/Exercism.TestRunner.CSharp/TestRun.cs
index ecb7488..3a6710a 100644
--- a/src/Exercism.TestRunner.CSharp/TestRun.cs
+++ b/src/Exercism.TestRunner.CSharp/TestRun.cs
@@ -16,6 +16,9 @@ internal class TestResult
[JsonPropertyName("status")]
public TestStatus Status { get; set; }
+
+ [JsonPropertyName("task_id")]
+ public int? TaskId { get; set; }
[JsonPropertyName("message")]
public string Message { get; set; }
@@ -30,7 +33,7 @@ internal class TestResult
internal class TestRun
{
[JsonPropertyName("version")]
- public int Version { get; set; } = 2;
+ public int Version { get; set; } = 3;
[JsonPropertyName("status")]
public TestStatus Status { get; set; }
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/Fake.cs b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/Fake.cs
new file mode 100644
index 0000000..4cf6208
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/Fake.cs
@@ -0,0 +1,8 @@
+public static class Fake
+{
+ public static int Add(int x, int y) => x + y;
+
+ public static int Sub(int x, int y) => x - y;
+
+ public static int Mul(int x, int y) => x * y;
+}
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/Fake.csproj
new file mode 100644
index 0000000..5e8fe89
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/Fake.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net5.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/FakeTests.cs b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/FakeTests.cs
new file mode 100644
index 0000000..4912272
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/FakeTests.cs
@@ -0,0 +1,17 @@
+using Xunit;
+using Exercism.Tests;
+
+public class FakeTests
+{
+ [Fact]
+ [Task(1)]
+ public void Add_should_add_numbers() => Assert.Equal(2, Fake.Add(1, 1));
+
+ [Fact]
+ [Task(2)]
+ public void Sub_should_subtract_numbers() => Assert.Equal(4, Fake.Sub(7, 3));
+
+ [Fact]
+ [Task(3)]
+ public void Mul_should_multiply_numbers() => Assert.Equal(6, Fake.Mul(2, 3));
+}
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/expected_results.json
new file mode 100644
index 0000000..5271940
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/AllTestsWithTask/expected_results.json
@@ -0,0 +1,24 @@
+{
+ "version": 3,
+ "status": "pass",
+ "tests": [
+ {
+ "name": "Add should add numbers",
+ "status": "pass",
+ "task_id": 1,
+ "test_code": "Assert.Equal(2, Fake.Add(1, 1))"
+ },
+ {
+ "name": "Sub should subtract numbers",
+ "status": "pass",
+ "task_id": 2,
+ "test_code": "Assert.Equal(1, Fake.Sub(2, 1))"
+ },
+ {
+ "name": "Mul should multiply numbers",
+ "status": "pass",
+ "task_id": 3,
+ "test_code": "Assert.Equal(5, Fake.Mul(2, 3))"
+ }
+ ]
+}
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleCompileErrors/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleCompileErrors/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleCompileErrors/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleCompileErrors/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleCompileErrors/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleCompileErrors/expected_results.json
index e5362d0..578e96e 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleCompileErrors/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleCompileErrors/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "error",
"message": "FakeTests.cs(5,66): error CS0117: \u0027Fake\u0027 does not contain a definition for \u0027Add\u0027\nFakeTests.cs(7,66): error CS0117: \u0027Fake\u0027 does not contain a definition for \u0027Sub\u0027",
"tests": []
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestClassesWithAllPasses/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestClassesWithAllPasses/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestClassesWithAllPasses/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestClassesWithAllPasses/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestClassesWithAllPasses/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestClassesWithAllPasses/expected_results.json
index d2609b0..b262652 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestClassesWithAllPasses/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestClassesWithAllPasses/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "pass",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithAllPasses/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithAllPasses/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithAllPasses/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithAllPasses/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithAllPasses/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithAllPasses/expected_results.json
index d535f60..daae437 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithAllPasses/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithAllPasses/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "pass",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithMultipleFails/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithMultipleFails/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithMultipleFails/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithMultipleFails/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithMultipleFails/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithMultipleFails/expected_results.json
index 7ac14e8..b485340 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithMultipleFails/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithMultipleFails/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "fail",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithSingleFail/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithSingleFail/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithSingleFail/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithSingleFail/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithSingleFail/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithSingleFail/expected_results.json
index 1eb5f17..b8c4557 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithSingleFail/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithSingleFail/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "fail",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutput/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutput/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutput/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutput/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutput/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutput/expected_results.json
index 07297e0..ffe7907 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutput/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutput/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "fail",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutputExceedingLimit/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutputExceedingLimit/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutputExceedingLimit/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutputExceedingLimit/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutputExceedingLimit/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutputExceedingLimit/expected_results.json
index 643a6b7..45af368 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutputExceedingLimit/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/MultipleTestsWithTestOutputExceedingLimit/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "fail",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/Fake.cs b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/Fake.cs
new file mode 100644
index 0000000..4cf6208
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/Fake.cs
@@ -0,0 +1,8 @@
+public static class Fake
+{
+ public static int Add(int x, int y) => x + y;
+
+ public static int Sub(int x, int y) => x - y;
+
+ public static int Mul(int x, int y) => x * y;
+}
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/Fake.csproj
new file mode 100644
index 0000000..5e8fe89
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/Fake.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net5.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/FakeTests.cs b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/FakeTests.cs
new file mode 100644
index 0000000..ea95247
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/FakeTests.cs
@@ -0,0 +1,10 @@
+using Xunit;
+public class FakeTests
+{
+ [Fact]
+ public void Add_should_add_numbers() => Assert.Equal(2, Fake.Add(1, 1));
+ [Fact]
+ public void Sub_should_subtract_numbers() => Assert.Equal(4, Fake.Sub(7, 3));
+ [Fact]
+ public void Mul_should_multiply_numbers() => Assert.Equal(6, Fake.Mul(2, 3));
+}
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/expected_results.json
new file mode 100644
index 0000000..d818f07
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTasks/expected_results.json
@@ -0,0 +1,21 @@
+{
+ "version": 3,
+ "status": "pass",
+ "tests": [
+ {
+ "name": "Add should add numbers",
+ "status": "pass",
+ "test_code": "Assert.Equal(2, Fake.Add(1, 1))"
+ },
+ {
+ "name": "Sub should subtract numbers",
+ "status": "pass",
+ "test_code": "Assert.Equal(1, Fake.Sub(2, 1))"
+ },
+ {
+ "name": "Mul should multiply numbers",
+ "status": "pass",
+ "test_code": "Assert.Equal(5, Fake.Mul(2, 3))"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTests/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTests/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTests/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTests/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTests/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTests/expected_results.json
index c65847d..21cface 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTests/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NoTests/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "error",
"tests": []
}
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NotImplemented/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NotImplemented/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NotImplemented/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NotImplemented/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NotImplemented/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NotImplemented/expected_results.json
index 1f3a681..351211a 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NotImplemented/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/NotImplemented/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "fail",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleCompileError/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleCompileError/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleCompileError/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleCompileError/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleCompileError/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleCompileError/expected_results.json
index 3587115..38e2f28 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleCompileError/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleCompileError/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "error",
"message": "Fake.cs(3,49): error CS1002: ; expected",
"tests": []
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatFails/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatFails/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatFails/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatFails/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatFails/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatFails/expected_results.json
index e53772c..04eaccf 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatFails/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatFails/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "fail",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPasses/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPasses/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPasses/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPasses/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPasses/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPasses/expected_results.json
index f82f93c..56365e0 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPasses/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPasses/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "pass",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPassesWithDifferentSlug/Foo.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPassesWithDifferentSlug/Foo.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPassesWithDifferentSlug/Foo.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPassesWithDifferentSlug/Foo.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPassesWithDifferentSlug/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPassesWithDifferentSlug/expected_results.json
index 607321a..42decf6 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPassesWithDifferentSlug/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SingleTestThatPassesWithDifferentSlug/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "pass",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/Fake.cs b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/Fake.cs
new file mode 100644
index 0000000..4cf6208
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/Fake.cs
@@ -0,0 +1,8 @@
+public static class Fake
+{
+ public static int Add(int x, int y) => x + y;
+
+ public static int Sub(int x, int y) => x - y;
+
+ public static int Mul(int x, int y) => x * y;
+}
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/Fake.csproj
new file mode 100644
index 0000000..5e8fe89
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/Fake.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net5.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/FakeTests.cs b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/FakeTests.cs
new file mode 100644
index 0000000..5601ca9
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/FakeTests.cs
@@ -0,0 +1,16 @@
+using Xunit;
+using Exercism.Tests;
+
+public class FakeTests
+{
+ [Fact]
+ [Task(1)]
+ public void Add_should_add_numbers() => Assert.Equal(2, Fake.Add(1, 1));
+
+ [Fact]
+ [Task(2)]
+ public void Sub_should_subtract_numbers() => Assert.Equal(4, Fake.Sub(7, 3));
+
+ [Fact]
+ public void Mul_should_multiply_numbers() => Assert.Equal(6, Fake.Mul(2, 3));
+}
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/expected_results.json
new file mode 100644
index 0000000..36ed682
--- /dev/null
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/SomeTestsWithTask/expected_results.json
@@ -0,0 +1,23 @@
+{
+ "version": 3,
+ "status": "pass",
+ "tests": [
+ {
+ "name": "Add should add numbers",
+ "status": "pass",
+ "task_id": 1,
+ "test_code": "Assert.Equal(2, Fake.Add(1, 1))"
+ },
+ {
+ "name": "Sub should subtract numbers",
+ "status": "pass",
+ "task_id": 2,
+ "test_code": "Assert.Equal(1, Fake.Sub(2, 1))"
+ },
+ {
+ "name": "Mul should multiply numbers",
+ "status": "pass",
+ "test_code": "Assert.Equal(5, Fake.Mul(2, 3))"
+ }
+ ]
+}
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/TestsInDifferentFormats/Fake.csproj b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/TestsInDifferentFormats/Fake.csproj
index 82704f3..5e8fe89 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/TestsInDifferentFormats/Fake.csproj
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/TestsInDifferentFormats/Fake.csproj
@@ -12,6 +12,7 @@
+
\ No newline at end of file
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/TestsInDifferentFormats/expected_results.json b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/TestsInDifferentFormats/expected_results.json
index bf8d2bc..cdb5d37 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/TestsInDifferentFormats/expected_results.json
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/TestsInDifferentFormats/expected_results.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"status": "pass",
"tests": [
{
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/TestRunResultReader.cs b/test/Exercism.TestRunner.CSharp.IntegrationTests/TestRunResultReader.cs
index 1594a33..d9d4db7 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/TestRunResultReader.cs
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/TestRunResultReader.cs
@@ -53,6 +53,9 @@ private enum TestStatus
private struct TestRunResult
{
+ [JsonPropertyName("version")]
+ public int Version { get; set; }
+
[JsonPropertyName("status")]
public TestStatus Status { get; set; }
@@ -73,6 +76,9 @@ private struct TestResult
[JsonPropertyName("name")]
public string Name { get; set; }
+
+ [JsonPropertyName("task_id")]
+ public int? TaskId { get; set; }
[JsonPropertyName("output")]
public string Output { get; set; }
diff --git a/test/Exercism.TestRunner.CSharp.IntegrationTests/TestRunnerTests.cs b/test/Exercism.TestRunner.CSharp.IntegrationTests/TestRunnerTests.cs
index f13e7e0..df59a7b 100644
--- a/test/Exercism.TestRunner.CSharp.IntegrationTests/TestRunnerTests.cs
+++ b/test/Exercism.TestRunner.CSharp.IntegrationTests/TestRunnerTests.cs
@@ -101,5 +101,26 @@ public void TestsInDifferentFormats()
var testRun = TestSolutionRunner.Run("TestsInDifferentFormats");
Assert.Equal(testRun.Expected, testRun.Actual);
}
+
+ [Fact]
+ public void NoTasks()
+ {
+ var testRun = TestSolutionRunner.Run("NoTasks");
+ Assert.Equal(testRun.Expected, testRun.Actual);
+ }
+
+ [Fact]
+ public void AllTestsWithTask()
+ {
+ var testRun = TestSolutionRunner.Run("AllTestsWithTask");
+ Assert.Equal(testRun.Expected, testRun.Actual);
+ }
+
+ [Fact]
+ public void SomeTestsWithTask()
+ {
+ var testRun = TestSolutionRunner.Run("SomeTestsWithTask");
+ Assert.Equal(testRun.Expected, testRun.Actual);
+ }
}
}
\ No newline at end of file