mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 15:01:28 +00:00
Create ItemWrapperContext class.
This commit is contained in:
parent
32b9ad32e1
commit
f9d54a73cd
@ -1,13 +1,15 @@
|
|||||||
using System.Collections.Generic;
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using csharp.Strategy;
|
||||||
|
|
||||||
namespace csharp
|
namespace csharp
|
||||||
{
|
{
|
||||||
public class GildedRose
|
public class GildedRose
|
||||||
{
|
{
|
||||||
IList<Item> Items;
|
IList<ItemWrapperContext> Items;
|
||||||
public GildedRose(IList<Item> Items)
|
public GildedRose(IList<Item> Items)
|
||||||
{
|
{
|
||||||
this.Items = Items;
|
this.Items = Items.Select(i => new ItemWrapperContext(i)).ToList<ItemWrapperContext>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateQuality()
|
public void UpdateQuality()
|
||||||
|
|||||||
56
csharp/Strategy/ItemWrapperContext.cs
Normal file
56
csharp/Strategy/ItemWrapperContext.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace csharp.Strategy
|
||||||
|
{
|
||||||
|
public class ItemWrapperContext
|
||||||
|
{
|
||||||
|
#region Variables
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return this._item.Name; }
|
||||||
|
set { this._item.Name = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Quality
|
||||||
|
{
|
||||||
|
get { return this._item.Quality; }
|
||||||
|
set { this._item.Quality = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SellIn
|
||||||
|
{
|
||||||
|
get { return this._item.SellIn; }
|
||||||
|
set { this._item.SellIn = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//private List<ICategoryStrategy> listCategoryStrategies;
|
||||||
|
private Item _item;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public ItemWrapperContext(Item item)
|
||||||
|
{
|
||||||
|
this._item = item;
|
||||||
|
|
||||||
|
//listCategoryStrategies = StrategiesFactory.GetInstance().GetCategoryStrategies(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
//public void UpdateQuality()
|
||||||
|
//{
|
||||||
|
// foreach (ICategoryStrategy categoryStrategyItem in this.listCategoryStrategies)
|
||||||
|
// {
|
||||||
|
// categoryStrategyItem.UpdateQuality(this);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -65,6 +65,7 @@
|
|||||||
<Compile Include="GildedRose.cs" />
|
<Compile Include="GildedRose.cs" />
|
||||||
<Compile Include="GildedRoseTest.cs" />
|
<Compile Include="GildedRoseTest.cs" />
|
||||||
<Compile Include="Item.cs" />
|
<Compile Include="Item.cs" />
|
||||||
|
<Compile Include="Strategy\ItemWrapperContext.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user