/// <summary> /// Applies the specified context of the command line option to the specified command line options. /// </summary> /// <param name="options">The command line options to apply the command line option.</param> /// <param name="context">The context of the command line option to be applied.</param> public void Apply(CarnaRunnerCommandLineOptions options, CarnaRunnerCommandLineOptionContext context) { if (!CanApply(context)) { return; } ApplyOption(options, context); }
/// <summary> /// Applies the specified context of the command line option to the specified command line options. /// </summary> /// <param name="options">The command line options to apply the command line option.</param> /// <param name="context">The context of the command line option to be applied.</param> /// <exception cref="InvalidCommandLineOptionException"> /// Settings file defined by <paramref name="context"/> does not exist. /// </exception> protected override void ApplyOption(CarnaRunnerCommandLineOptions options, CarnaRunnerCommandLineOptionContext context) { if (!File.Exists(context.Value)) { throw new InvalidCommandLineOptionException($@"Settings file does not exist. File: {context.Value}"); } options.SettingsFilePath = context.Value; }
/// <summary> /// Applies the specified context of the command line option to the specified command line options. /// </summary> /// <param name="options">The command line options to apply the command line option.</param> /// <param name="context">The context of the command line option to be applied.</param> /// <exception cref="InvalidCommandLineOptionException"> /// Assembly file defined by <paramref name="context"/> does not exist. /// </exception> protected override void ApplyOption(CarnaRunnerCommandLineOptions options, CarnaRunnerCommandLineOptionContext context) { if (!File.Exists(context.Argument)) { throw new InvalidCommandLineOptionException($@"Assembly file does not exist. File: {context.Argument}"); } options.Assemblies.Add(context.Argument); }
/// <summary> /// Parses the specified arguments of the command line. /// </summary> /// <param name="args">The arguments of the command line.</param> /// <returns>The new instance of the <see cref="CarnaRunnerCommandLineOptions"/>.</returns> /// <exception cref="InvalidCommandLineOptionException"> /// The argument of the command line is not specified and /// a settings file does not exist. /// </exception> protected virtual CarnaRunnerCommandLineOptions Parse(string[] args) { if (args.Any()) { return(ParseArguments(args)); } var options = new CarnaRunnerCommandLineOptions(); if (File.Exists(options.SettingsFilePath)) { return(options); } throw new InvalidCommandLineOptionException(@"Specify an assembly or setting file. The current working directory does not contain a settings file."); }
/// <summary> /// Applies the specified context of the command line option to the specified command line options. /// </summary> /// <param name="options">The command line options to apply the command line option.</param> /// <param name="context">The context of the command line option to be applied.</param> protected override void ApplyOption(CarnaRunnerCommandLineOptions options, CarnaRunnerCommandLineOptionContext context) { options.CanPause = true; }
public static bool Start(CarnaRunnerCommandLineOptions options) => new FixtureEngine() .AddOptions(options) .AddSummaryReporter() .Start();
public static FixtureEngine AddOptions(this FixtureEngine @this, CarnaRunnerCommandLineOptions options) { return(@this.LoadConfiguration(options.SettingsFilePath) .AddAssemblies(options.Assemblies) .AddDefaultFilter(options.Filter)); }
/// <summary> /// Applies the specified context of the command line option to the specified command line options. /// </summary> /// <param name="options">The command line options to apply the command line option.</param> /// <param name="context">The context of the command line option to be applied.</param> protected override void ApplyOption(CarnaRunnerCommandLineOptions options, CarnaRunnerCommandLineOptionContext context) { options.Filter = context.Value; }