示例#1
0
        public void Apply(ShootAction action, bool successful)
        {
            var successShot = SuccessAction(action, g => "Congratulations! You've scored a goal! You're amazing!");
            var failureShot = FailureAction(action, g => $"Unlucky this time! Ball goes to {game.BallOwner}");

            Apply(successShot, failureShot, successful);
        }
            public void MakeShotAndVerifyResults()
            {
                Ball ball     = new Ball(whereToStart: ZoneType.ATT);
                var  players  = Parameters.GetPlayers(ball);
                var  player   = players.Item1;
                var  opponent = players.Item2;

                ShootAction action = Parameters.Container.Get <ShootAction>();

                action.SetUp(Parameters.Container.Get <Game>().AddPlayer(player).AddPlayer(opponent));
                var shootParams = new EnemyParameters(opponent.Team);

                Assert.True(ball.Place == ZoneType.ATT);
                var executionStatus = action.Execute(shootParams);

                if (executionStatus)
                {
                    Assert.True(ball.Place == ZoneType.MID);
                    Assert.True(player.Team.HasBall == false);
                }
                else
                {
                    Assert.True(ball.IsOwner(opponent.Team));
                    Assert.True(ball.Place == ZoneType.DEF);
                }
            }