Ejemplo n.º 1
0
        public void NetworkPlayerMoveInteractorTest()
        {
            var playView             = new VoidView();
            var playerMoveInteractor = new NetworkPlayerMoveInteractor(level, playView);

            var oldPosition = level.CurrentPlayer.Position;

            playerMoveInteractor.IntentMove(level.CurrentPlayer, 0, 1);
            var newPosition = level.CurrentPlayer.Position;

            Assert.AreEqual(oldPosition.X + 1, newPosition.X);
            Assert.AreEqual(oldPosition.Y, newPosition.Y);

            oldPosition = level.Mobs[0].Position;
            playerMoveInteractor.IntentMove(level.Mobs[0], 1, 0);
            newPosition = level.Mobs[0].Position;

            Assert.AreEqual(oldPosition.X, newPosition.X);
            Assert.AreEqual(oldPosition.Y + 1, newPosition.Y);
        }
Ejemplo n.º 2
0
        public void ConfusedNetworkPlayerMoveInteractorTest()
        {
            var playView             = new VoidView();
            var playerMoveInteractor = new NetworkPlayerMoveInteractor(confusedLevel, playView);

            var oldPosition = confusedLevel.CurrentPlayer.Position;

            playerMoveInteractor.IntentMove(confusedLevel.CurrentPlayer, 0, 1);
            var newPosition = confusedLevel.CurrentPlayer.Position;

            Assert.IsTrue(Math.Abs(oldPosition.X - newPosition.X) <= 1);
            Assert.IsTrue(Math.Abs(oldPosition.Y - newPosition.Y) <= 1);
        }