private static bool ValidateOtherCommand(string inputCommand, out ToyActions toyAction) { var result = Enum.GetNames(typeof(ToyActions)).FirstOrDefault(x => string.Equals(x.ToString(), inputCommand, StringComparison.CurrentCultureIgnoreCase)); if (result != null) { toyAction = (ToyActions)Enum.Parse(typeof(ToyActions), result.ToString(), true); if (toyAction == ToyActions.Place) { toyAction = ToyActions.Invalid; } } else { toyAction = ToyActions.Invalid; } return toyAction == ToyActions.Invalid ? false : true; }
public ToyArgs() { _action = ToyActions.Invalid; _direction = MoveDirection.Invalid; _position = new Position(); }