-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51942bd
commit deaf5ff
Showing
7 changed files
with
114 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...cism.TestRunner.CSharp.IntegrationTests/Solutions/DifferentTypesOfTests/.meta/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"files": { | ||
"solution": ["Fake.cs"], | ||
"test": ["FakeTests.cs"], | ||
"example": [".meta/Example.cs"] | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/DifferentTypesOfTests/Fake.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
public static class Fake | ||
{ | ||
public static int Identity(int x) => x; | ||
|
||
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; | ||
|
||
public static int Div(int x, int y) => x / y; | ||
} |
20 changes: 20 additions & 0 deletions
20
test/Exercism.TestRunner.CSharp.IntegrationTests/Solutions/DifferentTypesOfTests/Fake.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Remove="Example.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" /> | ||
<PackageReference Include="Exercism.Tests" Version="0.1.0-alpha" /> | ||
<PackageReference Include="FsCheck" Version="2.16.3" /> | ||
<PackageReference Include="FsCheck.Xunit" Version="2.16.3" /> | ||
</ItemGroup> | ||
|
||
</Project> |
33 changes: 33 additions & 0 deletions
33
.../Exercism.TestRunner.CSharp.IntegrationTests/Solutions/DifferentTypesOfTests/FakeTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
|
||
using Xunit; | ||
using FsCheck.Xunit; | ||
using FsCheck; | ||
|
||
public class FakeTests | ||
{ | ||
[Fact] | ||
public void Identity() => | ||
Assert.Equal(2, Fake.Identity(2)); | ||
|
||
[Fact(Skip = "Remove this Skip property to run this test")] | ||
public void Add_should_add_numbers() => | ||
Assert.Equal(2, Fake.Add(1, 1)); | ||
|
||
[Theory(Skip = "Remove this Skip property to run this test")] | ||
[InlineData(4, 7, 3)] | ||
public void Sub_should_subtract_numbers(int expected, int x, int y) => | ||
Assert.Equal(expected, Fake.Sub(x, y)); | ||
|
||
[CustomPropertyAttribute(Skip = "Remove this Skip property to run this test")] | ||
public void Mul_should_multiply_numbers(int x, int y) => | ||
Assert.Equal(x * y, Fake.Mul(x, y)); | ||
|
||
[Property(Skip = "Remove this Skip property to run this test")] | ||
public Property Div_should_divide_numbers(int x) => | ||
Prop.Throws<DivideByZeroException, int>(new Lazy<int>(() => x / 0)); | ||
} | ||
|
||
public class CustomPropertyAttribute : PropertyAttribute | ||
{ | ||
} |
33 changes: 33 additions & 0 deletions
33
....TestRunner.CSharp.IntegrationTests/Solutions/DifferentTypesOfTests/expected_results.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"version": 3, | ||
"status": "pass", | ||
"tests": [ | ||
{ | ||
"name": "Identity", | ||
"status": "pass", | ||
"test_code": "Assert.Equal(2, Fake.Identity(2))" | ||
}, | ||
{ | ||
"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(expected, Fake.Sub(x, y))" | ||
}, | ||
{ | ||
"name": "Mul should multiply numbers", | ||
"status": "pass", | ||
"output": "Ok, passed 100 tests.", | ||
"test_code": "Assert.Equal(x * y, Fake.Mul(x, y))" | ||
}, | ||
{ | ||
"name": "Div should divide numbers", | ||
"status": "pass", | ||
"output": "Ok, passed 100 tests.", | ||
"test_code": "Prop.Throws\u003CDivideByZeroException, int\u003E(new Lazy\u003Cint\u003E(() =\u003E x / 0))" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters