From f1931e6f413bd54155048a21446ab1828b72c658 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Thu, 6 Jun 2024 17:41:45 +0200 Subject: [PATCH] Refactor C# projects : only keep 1 GildedRose Project which is used by both unit test projects --- csharp.xUnit/GildedRose.sln | 12 +-- csharp.xUnit/GildedRose/GildedRose.cs | 89 ------------------- csharp.xUnit/GildedRose/GildedRose.csproj | 9 -- csharp.xUnit/GildedRose/Item.cs | 8 -- csharp.xUnit/GildedRose/Program.cs | 61 ------------- .../GildedRoseTests/GildedRoseTests.csproj | 3 +- 6 files changed, 7 insertions(+), 175 deletions(-) delete mode 100644 csharp.xUnit/GildedRose/GildedRose.cs delete mode 100644 csharp.xUnit/GildedRose/GildedRose.csproj delete mode 100644 csharp.xUnit/GildedRose/Item.cs delete mode 100644 csharp.xUnit/GildedRose/Program.cs diff --git a/csharp.xUnit/GildedRose.sln b/csharp.xUnit/GildedRose.sln index 59e41407..dcedf6cc 100644 --- a/csharp.xUnit/GildedRose.sln +++ b/csharp.xUnit/GildedRose.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.10.34916.146 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GildedRose", "GildedRose\GildedRose.csproj", "{D781C52B-92C0-48BF-8414-177495DF4174}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GildedRoseTests", "GildedRoseTests\GildedRoseTests.csproj", "{CB6715CE-A283-4C70-9C1B-F58822077731}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C4DC2F6D-79E1-4AFB-8B3E-9305F18439CE}" @@ -12,20 +10,22 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GildedRose", "..\csharp.NUnit\GildedRose\GildedRose.csproj", "{6AA28AB6-2A7D-4AE8-A521-D5B4A95BCA9F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D781C52B-92C0-48BF-8414-177495DF4174}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D781C52B-92C0-48BF-8414-177495DF4174}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D781C52B-92C0-48BF-8414-177495DF4174}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D781C52B-92C0-48BF-8414-177495DF4174}.Release|Any CPU.Build.0 = Release|Any CPU {CB6715CE-A283-4C70-9C1B-F58822077731}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CB6715CE-A283-4C70-9C1B-F58822077731}.Debug|Any CPU.Build.0 = Debug|Any CPU {CB6715CE-A283-4C70-9C1B-F58822077731}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB6715CE-A283-4C70-9C1B-F58822077731}.Release|Any CPU.Build.0 = Release|Any CPU + {6AA28AB6-2A7D-4AE8-A521-D5B4A95BCA9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6AA28AB6-2A7D-4AE8-A521-D5B4A95BCA9F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6AA28AB6-2A7D-4AE8-A521-D5B4A95BCA9F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6AA28AB6-2A7D-4AE8-A521-D5B4A95BCA9F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/csharp.xUnit/GildedRose/GildedRose.cs b/csharp.xUnit/GildedRose/GildedRose.cs deleted file mode 100644 index c08bf5f8..00000000 --- a/csharp.xUnit/GildedRose/GildedRose.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System.Collections.Generic; - -namespace GildedRoseKata; - -public class GildedRose -{ - IList Items; - - public GildedRose(IList Items) - { - this.Items = Items; - } - - public void UpdateQuality() - { - for (var i = 0; i < Items.Count; i++) - { - if (Items[i].Name != "Aged Brie" && Items[i].Name != "Backstage passes to a TAFKAL80ETC concert") - { - if (Items[i].Quality > 0) - { - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") - { - Items[i].Quality = Items[i].Quality - 1; - } - } - } - else - { - if (Items[i].Quality < 50) - { - Items[i].Quality = Items[i].Quality + 1; - - if (Items[i].Name == "Backstage passes to a TAFKAL80ETC concert") - { - if (Items[i].SellIn < 11) - { - if (Items[i].Quality < 50) - { - Items[i].Quality = Items[i].Quality + 1; - } - } - - if (Items[i].SellIn < 6) - { - if (Items[i].Quality < 50) - { - Items[i].Quality = Items[i].Quality + 1; - } - } - } - } - } - - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") - { - Items[i].SellIn = Items[i].SellIn - 1; - } - - if (Items[i].SellIn < 0) - { - if (Items[i].Name != "Aged Brie") - { - if (Items[i].Name != "Backstage passes to a TAFKAL80ETC concert") - { - if (Items[i].Quality > 0) - { - if (Items[i].Name != "Sulfuras, Hand of Ragnaros") - { - Items[i].Quality = Items[i].Quality - 1; - } - } - } - else - { - Items[i].Quality = Items[i].Quality - Items[i].Quality; - } - } - else - { - if (Items[i].Quality < 50) - { - Items[i].Quality = Items[i].Quality + 1; - } - } - } - } - } -} \ No newline at end of file diff --git a/csharp.xUnit/GildedRose/GildedRose.csproj b/csharp.xUnit/GildedRose/GildedRose.csproj deleted file mode 100644 index 0e318c1b..00000000 --- a/csharp.xUnit/GildedRose/GildedRose.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - Exe - GildedRoseKata - net8.0 - - - \ No newline at end of file diff --git a/csharp.xUnit/GildedRose/Item.cs b/csharp.xUnit/GildedRose/Item.cs deleted file mode 100644 index 5ad18dea..00000000 --- a/csharp.xUnit/GildedRose/Item.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace GildedRoseKata; - -public class Item -{ - public string Name { get; set; } - public int SellIn { get; set; } - public int Quality { get; set; } -} \ No newline at end of file diff --git a/csharp.xUnit/GildedRose/Program.cs b/csharp.xUnit/GildedRose/Program.cs deleted file mode 100644 index 1c71999e..00000000 --- a/csharp.xUnit/GildedRose/Program.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace GildedRoseKata; - -public class Program -{ - public static void Main(string[] args) - { - Console.WriteLine("OMGHAI!"); - - IList 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}, - new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80}, - new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80}, - new Item - { - Name = "Backstage passes to a TAFKAL80ETC concert", - SellIn = 15, - Quality = 20 - }, - new Item - { - Name = "Backstage passes to a TAFKAL80ETC concert", - SellIn = 10, - Quality = 49 - }, - new Item - { - Name = "Backstage passes to a TAFKAL80ETC concert", - SellIn = 5, - Quality = 49 - }, - // this conjured item does not work properly yet - new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6} - }; - - var app = new GildedRose(items); - - int days = 2; - if (args.Length > 0) - { - days = int.Parse(args[0]) + 1; - } - - for (var i = 0; i < days; i++) - { - Console.WriteLine("-------- day " + i + " --------"); - Console.WriteLine("name, sellIn, quality"); - for (var j = 0; j < items.Count; j++) - { - Console.WriteLine(items[j].Name + ", " + items[j].SellIn + ", " + items[j].Quality); - } - Console.WriteLine(""); - app.UpdateQuality(); - } - } -} \ No newline at end of file diff --git a/csharp.xUnit/GildedRoseTests/GildedRoseTests.csproj b/csharp.xUnit/GildedRoseTests/GildedRoseTests.csproj index bed0eb47..623ac8bb 100644 --- a/csharp.xUnit/GildedRoseTests/GildedRoseTests.csproj +++ b/csharp.xUnit/GildedRoseTests/GildedRoseTests.csproj @@ -17,9 +17,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - +