public List<BaseResult<MoveResult>> Move(List<MoveRequest> moves)
        {
            var validator = new MoveRequestValidator();
            var results = new List<BaseResult<MoveResult>>();
            foreach (var move in moves)
            {
                var result = validator.Validate(move);

                if (result.IsValid)
                {
                    results.Add(_gameManager.Execute(move));
                }
                else
                {
                    results.Add(BaseResult<MoveResult>.Fail(errors: result.Errors.Select(e => e.ErrorMessage)));
                }
            }
            return results;
        }
Ejemplo n.º 2
0
        public List <BaseResult <MoveResult> > Move(List <MoveRequest> moves)
        {
            var validator = new MoveRequestValidator();
            var results   = new List <BaseResult <MoveResult> >();

            foreach (var move in moves)
            {
                var result = validator.Validate(move);

                if (result.IsValid)
                {
                    results.Add(_gameManager.Execute(move));
                }
                else
                {
                    results.Add(BaseResult <MoveResult> .Fail(errors: result.Errors.Select(e => e.ErrorMessage)));
                }
            }
            return(results);
        }