Skip to content

Commit

Permalink
Update tests package (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom authored Sep 10, 2021
1 parent 853ec2c commit f45543c
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Exercism.Tests" Version="0.1.0-alpha" />
<PackageReference Include="Exercism.Tests" Version="0.1.0-beta1" />
<PackageReference Include="Humanizer.Core" Version="2.8.26" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.9.0" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand Down
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"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public static class Fake
{
public static string Format(int x) => x.ToString("c");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<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-beta1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Xunit;
using Exercism.Tests;

public class FakeTests
{
[Fact]
[UseCulture]
public void Use_invariant_culture() => Assert.Equal("¤1,000.00", Fake.Format(1000));

[Fact]
[UseCulture("nl-NL")]
public void Use_dutch_culture() => Assert.Equal("€ 1.000,00", Fake.Format(1000));

[Fact]
[UseCulture("en-US")]
public void Use_us_culture() => Assert.Equal("$1,000.00", Fake.Format(1000));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": 3,
"status": "pass",
"tests": [
{
"name": "Use invariant culture",
"status": "pass",
"test_code": "Assert.Equal(\"¤1,000.00\", Fake.Format(1000))"
},
{
"name": "Use dutch culture",
"status": "pass",
"test_code": "Assert.Equal(\"€ 1.000,00\", Fake.Format(1000))"
},
{
"name": "Use us culture",
"status": "pass",
"test_code": "Assert.Equal(\"€ 1.000,00\", Fake.Format(1000))"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,12 @@ public void WithDisposable()
var testRun = TestSolutionRunner.Run("WithDisposable");
Assert.Equal(testRun.Expected, testRun.Actual);
}

[Fact]
public void UseCultureAttribute()
{
var testRun = TestSolutionRunner.Run("UseCultureAttribute");
Assert.Equal(testRun.Expected, testRun.Actual);
}
}
}

0 comments on commit f45543c

Please sign in to comment.