コード例 #1
0
        public void CorrectlyPrintsMessage_StatBonusAdded([Values] StatType statType, [Values(1, 3)] int bonusAmount)
        {
            StatBonusAppliedEventArgs e = new StatBonusAppliedEventArgs(statType, bonusAmount, false);

            _fighter.OnStatBonusApplied(e);

            MockOutputMessage[] outputs = _output.GetOutputs();

            Assert.AreEqual(1, outputs.Length);

            MockOutputMessage output = outputs[0];

            Assert.AreEqual($"{_fighter.DisplayName} gained +{bonusAmount} {statType.ToString().ToLower()}\n", output.Message);
        }
コード例 #2
0
        public void CorrectlySubscribesToMultipleFighters()
        {
            _output = new MockOutput();
            EventHandlerPrinter printer = new EventHandlerPrinter(_output);

            HumanFighter fighter2 = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1);
            HumanFighter fighter3 = (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1);

            printer.Subscribe(_fighter, fighter2, fighter3);

            StatBonusAppliedEventArgs e = new StatBonusAppliedEventArgs(StatType.Defense, 2, false);

            _fighter.OnStatBonusApplied(e);
            fighter2.OnStatBonusApplied(e);
            fighter3.OnStatBonusApplied(e);

            MockOutputMessage[] outputs = _output.GetOutputs();

            Assert.AreEqual(3, outputs.Length);
        }