public void Attack_WhenAttackerIdentifierIsNull_ShouldThrowException()
        {
            var mockedCreaturesFactory = new Mock<ICreaturesFactory>();
            var mockedLogger = new Mock<ILogger>();

            var mockedBattleManager = new MockedBattleManager(mockedCreaturesFactory.Object, mockedLogger.Object);

            var defenderIdentifier = CreatureIdentifier.CreatureIdentifierFromString("Angel(1)");

            Assert.Throws<NullReferenceException>(() => mockedBattleManager.Attack(null, defenderIdentifier));
        }
        public void Attack_WhenArmyNumbersAreEqual_ShouldThrowException()
        {
            var mockedCreaturesFactory = new Mock<ICreaturesFactory>();
            var mockedLogger = new Mock<ILogger>();

            var mockedBattleManager = new MockedBattleManager(mockedCreaturesFactory.Object, mockedLogger.Object);

            var attackerIdentifier = CreatureIdentifier.CreatureIdentifierFromString("Angel(1)");
            var defenderIdentifier = CreatureIdentifier.CreatureIdentifierFromString("Angel(1)");

            var creature = new Angel();

            mockedCreaturesFactory.Setup(x => x.CreateCreature(It.IsAny<string>())).Returns(creature);

            mockedLogger.Setup(x => x.WriteLine(It.IsAny<string>()));

            mockedBattleManager.AddCreatures(attackerIdentifier, 1);
            mockedBattleManager.AddCreatures(defenderIdentifier, 1);

            Assert.Throws<ArgumentException>(() => mockedBattleManager.Attack(attackerIdentifier, defenderIdentifier));
        }
        public void Attack_WhenIdentifiersAreValid_ShouldWorkCorrectly()
        {
            var mockedCreaturesFactory = new Mock<ICreaturesFactory>();
            var mockedLogger = new Mock<ILogger>();

            var mockedBattleManager = new MockedBattleManager(mockedCreaturesFactory.Object, mockedLogger.Object);

            var attackerIdentifier = CreatureIdentifier.CreatureIdentifierFromString("Angel(1)");
            var defenderIdentifier = CreatureIdentifier.CreatureIdentifierFromString("Angel(2)");

            var creature = new Angel();

            mockedCreaturesFactory.Setup(x => x.CreateCreature(It.IsAny<string>())).Returns(creature);

            mockedLogger.Setup(x => x.WriteLine(It.IsAny<string>()));

            mockedBattleManager.AddCreatures(attackerIdentifier, 1);
            mockedBattleManager.AddCreatures(defenderIdentifier, 1);

            mockedBattleManager.Attack(attackerIdentifier, defenderIdentifier);

            mockedLogger.Verify(x => x.WriteLine(It.IsAny<string>()), Times.Exactly(6));
        }