コード例 #1
0
        public int ConjuredQualityDegradesFaster(int sellIn, int quality)
        {
            IQualityStrategy conjuredQualityStrategy = ConjuredQualityStrategy.Instance;
            var inv = new InventoryItem {
                SellIn = sellIn, Quality = quality
            };

            return(conjuredQualityStrategy.UpdateQuality(inv));
        }
コード例 #2
0
        public int BackstagePassesCanImproveFaster(int sellIn, int quality)
        {
            IQualityStrategy backstageQualityStrategy = BackstagePassQualityStrategy.Instance;
            var inv = new InventoryItem {
                SellIn = sellIn, Quality = quality
            };

            return(backstageQualityStrategy.UpdateQuality(inv));
        }
コード例 #3
0
        public int QualityDegrades(int sellIn, int quality)
        {
            IQualityStrategy degradingQualityStrategy = DegradingQualityStrategy.Instance;
            var inv = new InventoryItem {
                SellIn = sellIn, Quality = quality
            };

            return(degradingQualityStrategy.UpdateQuality(inv));
        }
コード例 #4
0
        public int QualityCanImprove(int sellIn, int quality)
        {
            IQualityStrategy improveQualityStrategy = ImprovingQualityStrategy.Instance;
            var inv = new InventoryItem {
                SellIn = sellIn, Quality = quality
            };

            return(improveQualityStrategy.UpdateQuality(inv));
        }
コード例 #5
0
        public void QualityReducesNormally()
        {
            IQualityStrategy legendaryStrategy = LegendaryQualityStrategy.Instance;
            var inv = new InventoryItem {
                SellIn = 0, Quality = 5
            };

            Assert.AreEqual(5, legendaryStrategy.UpdateQuality(inv));
        }
コード例 #6
0
 public InventoryItem()
 {
     QualityStrategy = LegendaryQualityStrategy.Instance;
 }
コード例 #7
0
 public BackstagePassQualityStrategy(IQualityStrategy strategy)
     : base(strategy)
 {
 }
コード例 #8
0
ファイル: ItemUpgrade.cs プロジェクト: andy-uq/GildedRose
 public ItemUpgrade(Func<Item, bool> match, IItemAging itemAging = null, IQualityStrategy qualityStrategy = null)
 {
     _match = match;
     _qualityStrategy = qualityStrategy ?? new NormalQuality();
     _itemAging = itemAging ?? new NormalAging();
 }
コード例 #9
0
 public ConjuredQualityStrategy(IQualityStrategy strategy)
     : base(strategy)
 {
 }
コード例 #10
0
 public DefaultQualityStrategy(IQualityStrategy strategy)
     : base(strategy)
 {
 }
コード例 #11
0
 public QualityStrategyDecorator(IQualityStrategy strategy)
 {
     this.strategy = strategy;
 }
コード例 #12
0
 public ConjuredQualityStrategy(IQualityStrategy strategy)
     : base(strategy)
 {
 }
コード例 #13
0
 public QualityStrategyDecorator(IQualityStrategy strategy)
 {
     this.strategy = strategy;
 }
コード例 #14
0
 public AgedBrieQualityStrategy(IQualityStrategy strategy)
     : base(strategy)
 {
 }
コード例 #15
0
 public AgedBrieQualityStrategy(IQualityStrategy strategy)
     : base(strategy)
 {
 }
コード例 #16
0
 public DefaultQualityStrategy(IQualityStrategy strategy)
     : base(strategy)
 {
 }
コード例 #17
0
 public BackstagePassQualityStrategy(IQualityStrategy strategy)
     : base(strategy)
 {
 }
コード例 #18
0
 public ItemUpgrade(Func <Item, bool> match, IItemAging itemAging = null, IQualityStrategy qualityStrategy = null)
 {
     _match           = match;
     _qualityStrategy = qualityStrategy ?? new NormalQuality();
     _itemAging       = itemAging ?? new NormalAging();
 }