public class CommandProcessor
{
public enum CommandType
{
Start,
Stop,
Pause,
Unsupported // This command is intentionally not supported
}
public void ProcessCommand(CommandType command, [CallerMemberName] string? callerMemberName = null, [CallerFilePath] string? filePath = null, [CallerLineNumber] int line = 0)
{
_ = command switch
{
CommandType.Start => HandleStartCommand(),
CommandType.Stop => HandleStopCommand(),
CommandType.Pause => HandlePauseCommand(),
CommandType.Unsupported => throw new NotImplementedByDesignException($"The command '{nameof(CommandType.Unsupported)}' is not supported by design.", callerMemberName, filePath, line),
_ => throw new ArgumentException($"Invalid command: {command}", nameof(command))
};
}
private string HandleStartCommand() => "Started";
private string HandleStopCommand() => "Stopped";
private string HandlePauseCommand() => "Paused";
}