예제 #1
0
        public Player rps_game_winner(List <Player> _listPlayer)
        {
            validator = new Validator();
            validator.Add(new WrongNumberOfPlayersValidateResult(_listPlayer));
            validator.Add(new NoSuchStrategyValidateResult(_listPlayer));
            validator.Validate();

            return(PlayerWinner(_listPlayer));
        }
예제 #2
0
파일: Check.cs 프로젝트: dankunis/web-lab
        /// <summary>
        /// Add error to <see cref="Validator"/>.
        /// </summary>
        /// <param name="error">Error to add</param>
        public void Fail(Error error)
        {
            Assert.Argument(error, "error").NotNull();
            var key = Key;

            if (Validator?.ErrorKeyPrefix != null)
            {
                key = key != null ? $"{Validator.ErrorKeyPrefix}.{key}" : Validator.ErrorKeyPrefix;
            }
            error.Key = key;
            OnErrorAction?.Invoke(error);
            if (Validator != null)
            {
                Validator.Add(error);
            }
            else
            {
                throw new ErrorException(error);
            }
        }
예제 #3
0
        public virtual IActionResult Add(T entity)
        {
            var conveyorSingleResultBuilder = _validator.Add(entity);

            return(_conveyorResultCreator.GetSingleResult(conveyorSingleResultBuilder));
        }