From f9d54a73cde1faa92a447a05bbd5bbd5ef973e3c Mon Sep 17 00:00:00 2001 From: israel Date: Thu, 19 Oct 2017 13:25:03 +0100 Subject: [PATCH] Create ItemWrapperContext class. --- csharp/GildedRose.cs | 10 +++-- csharp/Strategy/ItemWrapperContext.cs | 56 +++++++++++++++++++++++++++ csharp/csharp.csproj | 1 + 3 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 csharp/Strategy/ItemWrapperContext.cs diff --git a/csharp/GildedRose.cs b/csharp/GildedRose.cs index c60d97a0..b8bd7d20 100644 --- a/csharp/GildedRose.cs +++ b/csharp/GildedRose.cs @@ -1,13 +1,15 @@ -using System.Collections.Generic; +using System.Linq; +using System.Collections.Generic; +using csharp.Strategy; namespace csharp { public class GildedRose { - IList Items; + IList Items; public GildedRose(IList Items) - { - this.Items = Items; + { + this.Items = Items.Select(i => new ItemWrapperContext(i)).ToList(); } public void UpdateQuality() diff --git a/csharp/Strategy/ItemWrapperContext.cs b/csharp/Strategy/ItemWrapperContext.cs new file mode 100644 index 00000000..82f53489 --- /dev/null +++ b/csharp/Strategy/ItemWrapperContext.cs @@ -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 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 + + } +} diff --git a/csharp/csharp.csproj b/csharp/csharp.csproj index 37813560..d213e84d 100644 --- a/csharp/csharp.csproj +++ b/csharp/csharp.csproj @@ -65,6 +65,7 @@ +