Beispiel #1
0
        public void PlayerMeetsCoin_Valid_Args_Test()
        {
            GameLogicMock target = new GameLogicMock();

            IVModel model = new VModel();

            // Create Objects
            ModelPlayer player = new ModelPlayer(model, 0, 10);
            ModelCoin coin = new ModelCoin(model, 10, 2);

            // Add Objects to model
            model.AddModelObject(player, new Point(10, 10));
            model.AddModelObject(coin, new Point(12, 12));

            var result = target.playerMeetsCoinAction(player, coin);

            Assert.AreEqual(1, target.CoinRemovedCounter);
        }
Beispiel #2
0
        public void ComputePosition_Valid_Test()
        {
            GameLogicMock target = new GameLogicMock();

            IVModel model = new VModel();

            Point size = new Point();
            size.X = 100;
            size.Y = 50;

            model.Map = new Map2d(size);

            // Insert a Wall exactly in the middle
            model.Map.InsertWall(new Wall() { Start = new Point() { X = 0, Y = 25 }, End = new Point() { X = 100, Y = 25 } });

            Point toPosition = new Point(20, 10);

            // Create Objects
            ModelPlayer player = new ModelPlayer(model, 0, 10); // what is the size?
            ModelCoin coin = new ModelCoin(model, 10, 2);

            // Add Objects to model
            model.AddModelObject(player, new Point(10, 10));
            model.AddModelObject(coin, toPosition);

            bool result = target.computePosition(player, toPosition, true, true);

            Assert.AreEqual(true, result);
            Assert.AreEqual(1, target.CoinRemovedCounter);
        }