From ffdfe37fcd6cdf970ad09a99935322b93b56882e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bagnier?= Date: Fri, 27 Oct 2023 10:40:48 +0200 Subject: [PATCH] make csharpcore work. I add a missing NuGet, use only one test framework, downgrade to NET6 LTS and var some variables. --- csharpcore/GildedRose/GildedRose.csproj | 2 +- csharpcore/GildedRoseTests/ApprovalTest.cs | 3 +-- csharpcore/GildedRoseTests/GildedRoseTest.cs | 14 +++++++------- csharpcore/GildedRoseTests/GildedRoseTests.csproj | 13 +++++++------ csharpcore/GildedRoseTests/TextTestFixture.cs | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/csharpcore/GildedRose/GildedRose.csproj b/csharpcore/GildedRose/GildedRose.csproj index 082dac9c..fff78129 100644 --- a/csharpcore/GildedRose/GildedRose.csproj +++ b/csharpcore/GildedRose/GildedRose.csproj @@ -1,7 +1,7 @@  - net7.0 + net6.0 diff --git a/csharpcore/GildedRoseTests/ApprovalTest.cs b/csharpcore/GildedRoseTests/ApprovalTest.cs index 217ae030..4086ecf2 100644 --- a/csharpcore/GildedRoseTests/ApprovalTest.cs +++ b/csharpcore/GildedRoseTests/ApprovalTest.cs @@ -8,13 +8,12 @@ using NUnit.Framework; namespace GildedRoseTests; [UseReporter(typeof(DiffReporter))] -[TestFixture] public class ApprovalTest { [Test] public void ThirtyDays() { - StringBuilder fakeOutput = new StringBuilder(); + var fakeOutput = new StringBuilder(); Console.SetOut(new StringWriter(fakeOutput)); Console.SetIn(new StringReader($"a{Environment.NewLine}")); diff --git a/csharpcore/GildedRoseTests/GildedRoseTest.cs b/csharpcore/GildedRoseTests/GildedRoseTest.cs index e5902535..3eb66aaa 100644 --- a/csharpcore/GildedRoseTests/GildedRoseTest.cs +++ b/csharpcore/GildedRoseTests/GildedRoseTest.cs @@ -1,17 +1,17 @@ -using Xunit; -using System.Collections.Generic; +using System.Collections.Generic; using GildedRoseKata; - +using NUnit.Framework; + namespace GildedRoseTests; public class GildedRoseTest { - [Fact] + [Test] public void Foo() { - IList items = new List { new Item { Name = "foo", SellIn = 0, Quality = 0 } }; - GildedRose app = new GildedRose(items); + var items = new List { new Item { Name = "foo", SellIn = 0, Quality = 0 } }; + var app = new GildedRose(items); app.UpdateQuality(); - Assert.Equal("fixme", items[0].Name); + Assert.AreEqual("fixme", items[0].Name); } } \ No newline at end of file diff --git a/csharpcore/GildedRoseTests/GildedRoseTests.csproj b/csharpcore/GildedRoseTests/GildedRoseTests.csproj index fab24a04..ee2e9319 100644 --- a/csharpcore/GildedRoseTests/GildedRoseTests.csproj +++ b/csharpcore/GildedRoseTests/GildedRoseTests.csproj @@ -2,17 +2,18 @@ Exe - net7.0 + net6.0 GildedRoseTests.TextTestFixture - - + + - - - + runtime; build; native; contentfiles; analyzers; buildtransitive +all + + diff --git a/csharpcore/GildedRoseTests/TextTestFixture.cs b/csharpcore/GildedRoseTests/TextTestFixture.cs index cb95a8b2..41048211 100644 --- a/csharpcore/GildedRoseTests/TextTestFixture.cs +++ b/csharpcore/GildedRoseTests/TextTestFixture.cs @@ -10,7 +10,7 @@ public static class TextTestFixture { Console.WriteLine("OMGHAI!"); - IList items = new List{ + var items = new List{ new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20}, new Item {Name = "Aged Brie", SellIn = 2, Quality = 0}, new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7},