Merge pull request #402 from claresudbery/csharp-approval-fixes

Csharp approval fixes
This commit is contained in:
Emily Bache 2023-04-11 13:35:32 +02:00 committed by GitHub
commit 5a4e92199b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 2 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ obj
vendor
.idea
*.iml
csharpcore/GildedRoseTests/ApprovalTest.ThirtyDays.received.txt

View File

@ -0,0 +1,29 @@
using System;
using System.IO;
using System.Text;
using ApprovalTests;
using ApprovalTests.Reporters;
using GildedRoseTests;
using NUnit.Framework;
namespace csharp
{
[UseReporter(typeof(DiffReporter))]
[TestFixture]
public class ApprovalTest
{
[Test]
public void ThirtyDays()
{
StringBuilder fakeoutput = new StringBuilder();
Console.SetOut(new StringWriter(fakeoutput));
Console.SetIn(new StringReader("a\n"));
TexttestFixture.Main(new string[] { });
var output = fakeoutput.ToString();
Approvals.Verify(output);
}
}
}

View File

@ -7,7 +7,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ApprovalTests" Version="5.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="coverlet.collector" Version="3.1.0" />

View File

@ -42,7 +42,7 @@ namespace GildedRoseTests
var app = new GildedRose(Items);
int days = 2;
int days = 31;
if (args.Length > 0)
{
days = int.Parse(args[0]) + 1;

View File

@ -21,7 +21,7 @@ diff_program:meld
#interpreter:ruby
# Settings for the C# version
#executable:${TEXTTEST_HOME}/GildedRose.exe
#executable:${TEXTTEST_HOME}/csharp/bin/Debug/csharp.exe
# Settings for the Perl version
#executable:${TEXTTEST_HOME}/perl/texttest_fixture.pl