Skip to content

Commit

Permalink
Merge pull request emilybache#402 from claresudbery/csharp-approval-f…
Browse files Browse the repository at this point in the history
…ixes

Csharp approval fixes
  • Loading branch information
emilybache authored Apr 11, 2023
2 parents 2277295 + 8d30f5e commit 5a4e921
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ obj
vendor
.idea
*.iml
csharpcore/GildedRoseTests/ApprovalTest.ThirtyDays.received.txt
29 changes: 29 additions & 0 deletions csharpcore/GildedRoseTests/ApprovalTest.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
2 changes: 2 additions & 0 deletions csharpcore/GildedRoseTests/GildedRoseTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
2 changes: 1 addition & 1 deletion csharpcore/GildedRoseTests/TexttestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static void Main(string[] args)

var app = new GildedRose(Items);

int days = 2;
int days = 31;
if (args.Length > 0)
{
days = int.Parse(args[0]) + 1;
Expand Down
2 changes: 1 addition & 1 deletion texttests/config.gr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5a4e921

Please sign in to comment.