mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-13 17:49:25 +00:00
cleanup
This commit is contained in:
1 parent
6a91a10bfa
commit
ad56fa1ce0
7 files changed
+144
-152
No files matched your search
@@ -3,27 +3,24 @@ using System.IO;
|
||||
using System.Text;
|
||||
using ApprovalTests;
|
||||
using ApprovalTests.Reporters;
|
||||
using GildedRoseTests;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace csharp
|
||||
namespace GildedRoseTests;
|
||||
|
||||
[UseReporter(typeof(DiffReporter))]
|
||||
[TestFixture]
|
||||
public class ApprovalTest
|
||||
{
|
||||
[UseReporter(typeof(DiffReporter))]
|
||||
[TestFixture]
|
||||
public class ApprovalTest
|
||||
[Test]
|
||||
public void ThirtyDays()
|
||||
{
|
||||
[Test]
|
||||
public void ThirtyDays()
|
||||
{
|
||||
|
||||
StringBuilder fakeoutput = new StringBuilder();
|
||||
Console.SetOut(new StringWriter(fakeoutput));
|
||||
Console.SetIn(new StringReader("a\n"));
|
||||
StringBuilder fakeOutput = new StringBuilder();
|
||||
Console.SetOut(new StringWriter(fakeOutput));
|
||||
Console.SetIn(new StringReader($"a{Environment.NewLine}"));
|
||||
|
||||
TexttestFixture.Main(new string[] { });
|
||||
var output = fakeoutput.ToString();
|
||||
TextTestFixture.Main(new string[] { });
|
||||
var output = fakeOutput.ToString();
|
||||
|
||||
Approvals.Verify(output);
|
||||
}
|
||||
Approvals.Verify(output);
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,16 @@
|
||||
using System.Collections.Generic;
|
||||
using GildedRoseKata;
|
||||
|
||||
namespace GildedRoseTests
|
||||
namespace GildedRoseTests;
|
||||
|
||||
public class GildedRoseTest
|
||||
{
|
||||
public class GildedRoseTest
|
||||
[Fact]
|
||||
public void Foo()
|
||||
{
|
||||
[Fact]
|
||||
public void foo()
|
||||
{
|
||||
IList<Item> Items = new List<Item> { new Item { Name = "foo", SellIn = 0, Quality = 0 } };
|
||||
GildedRose app = new GildedRose(Items);
|
||||
app.UpdateQuality();
|
||||
Assert.Equal("fixme", Items[0].Name);
|
||||
}
|
||||
IList<Item> items = new List<Item> { new Item { Name = "foo", SellIn = 0, Quality = 0 } };
|
||||
GildedRose app = new GildedRose(items);
|
||||
app.UpdateQuality();
|
||||
Assert.Equal("fixme", items[0].Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<StartupObject>GildedRoseTests.TexttestFixture</StartupObject>
|
||||
<StartupObject>GildedRoseTests.TextTestFixture</StartupObject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -19,4 +19,4 @@
|
||||
<ProjectReference Include="..\GildedRose\GildedRose.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GildedRoseKata;
|
||||
|
||||
namespace GildedRoseTests;
|
||||
|
||||
public static class TextTestFixture
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("OMGHAI!");
|
||||
|
||||
IList<Item> items = new List<Item>{
|
||||
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 = 31;
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
|
||||
using GildedRoseKata;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GildedRoseTests
|
||||
{
|
||||
public static class TexttestFixture
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("OMGHAI!");
|
||||
|
||||
IList<Item> Items = new List<Item>{
|
||||
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 = 31;
|
||||
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++)
|
||||
{
|
||||
System.Console.WriteLine(Items[j].Name + ", " + Items[j].SellIn + ", " + Items[j].Quality);
|
||||
}
|
||||
Console.WriteLine("");
|
||||
app.UpdateQuality();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user