Exemplo n.º 1
0
        public void BattleDummyCreatorDamageDealtTest()
        {
            var war     = CreateTestWar();
            var creator = new BattleDummyCreator();

            creator.AttackerBattleParticipants = 1;
            creator.SetWallHealth(0);

            var battle = creator.Create(war, true);

            Assert.IsTrue(battle.WallHealth < 0);
        }
Exemplo n.º 2
0
        public void BattleDummyCreatorProperParticipantsCountTest()
        {
            var war     = CreateTestWar();
            var creator = new BattleDummyCreator();

            creator.AttackerBattleParticipants = 5;
            creator.DefenderBattleParticipants = 10;

            var battle = creator.Create(war, true);

            Assert.AreEqual(5, battle.BattleParticipants.Where(p => p.IsAttacker).Count());
            Assert.AreEqual(10, battle.BattleParticipants.Where(p => p.IsAttacker == false).Count());
            Assert.AreEqual(15, battle.BattleParticipants.Count());
        }
Exemplo n.º 3
0
        public void StartRessistanceBattle_activeWar_test()
        {
            var war = new WarDummyCreator()
                      .MakeRessistance()
                      .Create();

            var battle = new BattleDummyCreator()
                         .Create(war, false);

            var battleService = new Mock <IBattleService>();

            battleService.Setup(x => x.CreateBattle(It.IsAny <War>(), It.IsAny <int>(), It.IsAny <WarSideEnum>()))
            .Returns(battle);

            mockWarService.Setup(x => x.GetActiveRessistanceWar(It.IsAny <Country>(), It.IsAny <int>()))
            .Returns(war);

            var newBattle = warService.StartRessistanceBattle(new CitizenDummyCreator().SetCountry(war.Attacker).Create(), war.Defender.Regions.First(), battleService.Object);

            Assert.AreEqual(battle, newBattle);

            battleService.Verify(x => x.CreateBattle(It.IsAny <War>(), It.IsAny <int>(), It.Is <WarSideEnum>(side => side == WarSideEnum.Attacker)));
        }