public void testAddNewBuilding()
        {
            initialize();
            ZRTSModel.Entities.Building b = new ZRTSModel.Entities.Building(testScenario.getPlayer(), new ZRTSModel.Entities.BuildingStats());

            ///Test building at location (8,8). Should fail because of impassible tile
            ///at (9,9).
            bool success = testGameController.addEntity(b, 8, 8);
            Assert.False(success);
            ///Test building ontop of unit at location (17,17). Should fail, because there is a unit there
            success = testGameController.addEntity(b, 17, 17);
            Assert.False(success);
            ///Test building at location(0,0). Should succeed.
            success = testGameController.addEntity(b, 0, 0);
            Assert.True(success);
            ///Test building at location (12,12). Should fail from lack of resources.
            success = testGameController.addEntity(b, 12, 12);
            Assert.False(success);
        }
        public void testAddNewBuilding()
        {
            initialize();
            ZRTSModel.Entities.Building b = new ZRTSModel.Entities.Building(testScenario.getPlayer(), new ZRTSModel.Entities.BuildingStats());

            ///Test building at location (8,8). Should fail because of impassible tile
            ///at (9,9).
            bool success = testGameController.addEntity(b, 8, 8);

            Assert.False(success);
            ///Test building ontop of unit at location (17,17). Should fail, because there is a unit there
            success = testGameController.addEntity(b, 17, 17);
            Assert.False(success);
            ///Test building at location(0,0). Should succeed.
            success = testGameController.addEntity(b, 0, 0);
            Assert.True(success);
            ///Test building at location (12,12). Should fail from lack of resources.
            success = testGameController.addEntity(b, 12, 12);
            Assert.False(success);
        }
        /// <summary>
        /// Give a command when click at icons
        /// </summary>
        /// <param name="input"></param>
        /// <param name="gameView"></param>
        /// <param name="testGameController"></param>
        private void giveCommand(MouseState input, View gameView, Controller testGameController)
        {
            commandX = gameView.convertScreenLocToGameLoc(input.X, input.Y).X;
            commandY = gameView.convertScreenLocToGameLoc(input.X, input.Y).Y;

            if (testGameController.isWithinGameBound(commandX, commandY))
            {
                foreach (ZRTSModel.Entities.Entity entity in testGameController.scenario.getPlayer().SelectedEntities)
                {
                    ZRTSModel.GameWorld.Cell cell = testGameController.gameWorld.map.getCell((int)commandX, (int)commandY);
                    if (currentPlayerCommand == PlayerCommand.BUILD)
                    {
                        ZRTSModel.Entities.Building building = new ZRTSModel.Entities.Building(testGameController.scenario.getPlayer(), new ZRTSModel.Entities.BuildingStats());

                        if (testGameController.makeUnitBuild(entity,building, cell))
                        {
                            System.Console.Out.WriteLine("Building at " + commandX + ":" + commandY);
                        }
                        else
                        {
                            System.Console.Out.WriteLine("Can't place a building at " + commandX + ":" + commandY);
                        }
                    }
                    else
                    {
                        if (cell.entity != null)
                        {
                            // TODO: Check that the Entity belongs to an enemy. If not, Move to the entity instead,
                            // TODO: Check if a Resource was clicked, should be harvested or ignored instead.
                            // TODO: Check if Entity is a frienfly building, if so and the unit can build buildings, have unit repair
                            // the building instead.
                            if (entity.entityType == ZRTSModel.Entities.Entity.EntityType.Unit)
                            {
                                    // Right-Clicked on an Entity, Attack the Entity.
                                    System.Console.Out.WriteLine("Selected Attack Entity at " + commandX + ":" + commandY);
                                    testGameController.giveActionCommand(entity,
                                             new ZRTSLogic.Action.SimpleAttackAction((ZRTSModel.Entities.Unit)entity, cell.entity));
                            }
                        }
                        else if (cell.getUnit() != null)
                        {
                            // Right-Clicked on a Unit, attack the Unit.
                            // TODO: Check that the enemy is an entity.
                            if (entity.entityType == ZRTSModel.Entities.Entity.EntityType.Unit)
                            {
                                    System.Console.Out.WriteLine("Selected Attack Unit at " + commandX + ":" + commandY);
                                    ZRTSLogic.Action.AttackAction attackAction = new ZRTSLogic.Action.AttackAction((ZRTSModel.Entities.Unit)entity, cell.getUnit(), testGameController.gameWorld);
                                    testGameController.giveActionCommand(entity, attackAction);
                                    //testGameController.giveActionCommand(entity,
                                             //new ZRTSLogic.Action.SimpleAttackAction((ZRTSModel.Entities.Unit)entity, cell.getUnit()));
                            }
                        }
                        else
                        {
                            // Clicked Cell is empty, have the Unit move to the location.
                            testGameController.giveActionCommand(entity, new ZRTSLogic.Action.MoveAction(commandX, commandY, testGameController.gameWorld, entity));
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Give a command when click at icons
        /// </summary>
        /// <param name="input"></param>
        /// <param name="gameView"></param>
        /// <param name="testGameController"></param>
        private void giveCommand(MouseState input, View gameView, Controller testGameController)
        {
            commandX = gameView.convertScreenLocToGameLoc(input.X, input.Y).X;
            commandY = gameView.convertScreenLocToGameLoc(input.X, input.Y).Y;


            if (testGameController.isWithinGameBound(commandX, commandY))
            {
                foreach (ZRTSModel.Entities.Entity entity in testGameController.scenario.getPlayer().SelectedEntities)
                {
                    ZRTSModel.GameWorld.Cell cell = testGameController.gameWorld.map.getCell((int)commandX, (int)commandY);
                    if (currentPlayerCommand == PlayerCommand.BUILD)
                    {
                        ZRTSModel.Entities.Building building = new ZRTSModel.Entities.Building(testGameController.scenario.getPlayer(), new ZRTSModel.Entities.BuildingStats());

                        if (testGameController.makeUnitBuild(entity, building, cell))
                        {
                            System.Console.Out.WriteLine("Building at " + commandX + ":" + commandY);
                        }
                        else
                        {
                            System.Console.Out.WriteLine("Can't place a building at " + commandX + ":" + commandY);
                        }
                    }
                    else
                    {
                        if (cell.entity != null)
                        {
                            // TODO: Check that the Entity belongs to an enemy. If not, Move to the entity instead,
                            // TODO: Check if a Resource was clicked, should be harvested or ignored instead.
                            // TODO: Check if Entity is a frienfly building, if so and the unit can build buildings, have unit repair
                            // the building instead.
                            if (entity.entityType == ZRTSModel.Entities.Entity.EntityType.Unit)
                            {
                                // Right-Clicked on an Entity, Attack the Entity.
                                System.Console.Out.WriteLine("Selected Attack Entity at " + commandX + ":" + commandY);
                                testGameController.giveActionCommand(entity,
                                                                     new ZRTSLogic.Action.SimpleAttackAction((ZRTSModel.Entities.Unit)entity, cell.entity));
                            }
                        }
                        else if (cell.getUnit() != null)
                        {
                            // Right-Clicked on a Unit, attack the Unit.
                            // TODO: Check that the enemy is an entity.
                            if (entity.entityType == ZRTSModel.Entities.Entity.EntityType.Unit)
                            {
                                System.Console.Out.WriteLine("Selected Attack Unit at " + commandX + ":" + commandY);
                                ZRTSLogic.Action.AttackAction attackAction = new ZRTSLogic.Action.AttackAction((ZRTSModel.Entities.Unit)entity, cell.getUnit(), testGameController.gameWorld);
                                testGameController.giveActionCommand(entity, attackAction);
                                //testGameController.giveActionCommand(entity,
                                //new ZRTSLogic.Action.SimpleAttackAction((ZRTSModel.Entities.Unit)entity, cell.getUnit()));
                            }
                        }
                        else
                        {
                            // Clicked Cell is empty, have the Unit move to the location.
                            testGameController.giveActionCommand(entity, new ZRTSLogic.Action.MoveAction(commandX, commandY, testGameController.gameWorld, entity));
                        }
                    }
                }
            }
        }