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)); }
/// <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); } }
public virtual IActionResult Add(T entity) { var conveyorSingleResultBuilder = _validator.Add(entity); return(_conveyorResultCreator.GetSingleResult(conveyorSingleResultBuilder)); }