Exemple #1
0
        public void AddStrategy_SuccessfullyAddedStrategy()
        {
            this.strategyHolder = new StrategyHolder();

            var strategyType = typeof(Burnable);
            var strategy = new BurnableStrategy();

            var isAdded = this.strategyHolder.AddStrategy(strategyType, strategy);

            Assert.IsTrue(isAdded, "The srategy was not added successfully to a newly instantiated StrategyHolder");
        }
Exemple #2
0
        public void RemoveStrategy_SuccessfullyRemovedStrategy()
        {
            this.strategyHolder = new StrategyHolder();

            var strategyType = typeof(Burnable);
            var strategy = new BurnableStrategy();

            this.strategyHolder.AddStrategy(strategyType, strategy);
            var isRemoved = this.strategyHolder.RemoveStrategy(strategyType);

            Assert.IsTrue(isRemoved, "The strategy was not successfully removed from the StrategyHolder");
        }
Exemple #3
0
        public void AddStrategy_UnableToAddStrategy()
        {
            this.strategyHolder = new StrategyHolder();

            var strategyType = typeof(Burnable);
            var strategy = new BurnableStrategy();

            this.strategyHolder.AddStrategy(strategyType, strategy);
            var isAdded = this.strategyHolder.AddStrategy(strategyType, strategy);

            Assert.IsFalse(isAdded, "The srategy should not be added twice to a StrategyHolder");
        }