Esempio n. 1
0
        public void RangedInRangeTest()
        {
            var rangeActorConfig = new Mock <IBsActorConfig>();

            rangeActorConfig.Setup(x => x.AttackType()).Returns(ActorAttackType.Range);

            _actor1.Setup(x => x.Config()).Returns(rangeActorConfig.Object);
            var model = new BsRange(_board.Object, _config.Object);

            for (int i = 1; i <= 20; i = i << 1)
            {
                var res = new BsActionResult();
                _board.Setup(x => x.Distance(It.IsAny <IBsActor>(), It.IsAny <IBsActor>())).Returns(i);
                model.CheckAttackDst(_actor1.Object, _actor2.Object, res);
                Assert.IsTrue(res.Ok);
            }

            for (int i = 21; i < 100; i = i << 1)
            {
                var res = new BsActionResult();
                _board.Setup(x => x.Distance(It.IsAny <IBsActor>(), It.IsAny <IBsActor>())).Returns(i);
                model.CheckAttackDst(_actor1.Object, _actor2.Object, res);
                Assert.IsFalse(res.Ok);
            }
        }
Esempio n. 2
0
        public void MeleeInRangeTest()
        {
            var model = new BsRange(_board.Object, _config.Object);

            for (int i = 0; i <= 2; i++)
            {
                var res = new BsActionResult();
                _board.Setup(x => x.Distance(It.IsAny <IBsActor>(), It.IsAny <IBsActor>())).Returns(i);
                model.CheckAttackDst(_actor1.Object, _actor2.Object, res);
                Assert.IsTrue(res.Ok);
            }

            for (int i = 3; i < 25; i = i << 1)
            {
                var res = new BsActionResult();
                _board.Setup(x => x.Distance(It.IsAny <IBsActor>(), It.IsAny <IBsActor>())).Returns(i);
                model.CheckAttackDst(_actor1.Object, _actor2.Object, res);
                Assert.IsFalse(res.Ok);
            }
        }