diff --git a/.gitignore b/.gitignore index 95bd72b9..f86e7561 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ obj vendor .idea *.iml +csharpcore/GildedRoseTests/ApprovalTest.ThirtyDays.received.txt diff --git a/csharpcore/GildedRoseTests/ApprovalTest.cs b/csharpcore/GildedRoseTests/ApprovalTest.cs new file mode 100644 index 00000000..db1dc91c --- /dev/null +++ b/csharpcore/GildedRoseTests/ApprovalTest.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/csharpcore/GildedRoseTests/GildedRoseTests.csproj b/csharpcore/GildedRoseTests/GildedRoseTests.csproj index 93a44263..0db31f52 100644 --- a/csharpcore/GildedRoseTests/GildedRoseTests.csproj +++ b/csharpcore/GildedRoseTests/GildedRoseTests.csproj @@ -7,7 +7,9 @@ + + diff --git a/csharpcore/GildedRoseTests/TexttestFixture.cs b/csharpcore/GildedRoseTests/TexttestFixture.cs index cccaf5f9..e95c4e08 100644 --- a/csharpcore/GildedRoseTests/TexttestFixture.cs +++ b/csharpcore/GildedRoseTests/TexttestFixture.cs @@ -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; diff --git a/texttests/config.gr b/texttests/config.gr index 7183e174..1462cc1b 100755 --- a/texttests/config.gr +++ b/texttests/config.gr @@ -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