public void ShouldPrependProcessArgument()
            {
                var result = new ProcessArgumentBuilder();

                result.Append("last");
                result.Prepend(new TextArgument("text arg"));
                result.RenderSafe();

                Assert.Equal("\"text arg\" last", result);
            }
Esempio n. 2
0
 /// <summary>
 /// <para>For applying these settings in a pipeline; returns a delegate to transform a `ProcessArgumentBuilder` based on the current settings</para>
 /// </summary>
 /// <returns>`ProcessArgumentBuilder` to `ProcessArgumentBuilder` transform</returns>
 public Func <ProcessArgumentBuilder, ProcessArgumentBuilder> Customize()
 {
     return(pabIn =>
     {
         var pabOut = new ProcessArgumentBuilder();
         if (pabIn != null)
         {
             pabIn.CopyTo(pabOut);
         }
         var args = FSDotNet.ToTestArgumentList(
             this.PreparationPhase,
             this.CollectionPhase,
             this.Options).ToArray();
         Array.Reverse(args);
         Array.ForEach(
             args,
             t => pabOut.Prepend(t));
         return pabOut;
     });
 }
Esempio n. 3
0
 /// <summary>
 /// Prepend the specified text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="text">The text to be prepended.</param>
 /// <param name="renderer">The renderer which handles quoting and escaping.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder Prepend(this ProcessArgumentBuilder builder, string text, IProcessArgumentRenderer renderer)
 {
     builder?.Prepend(new TextArgument(text, renderer));
     return(builder);
 }
Esempio n. 4
0
 /// <summary>
 /// Prepend the specified secret text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="switch">The switch preceding the text.</param>
 /// <param name="separator">The separator between the switch and argument</param>
 /// <param name="argument">The secret argument to be prepended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder PrependSwitchSecret(this ProcessArgumentBuilder builder, string @switch, string separator, IProcessArgument argument)
 {
     builder?.Prepend(new SwitchArgument(@switch, new SecretArgument(argument), separator));
     return(builder);
 }
Esempio n. 5
0
 /// <summary>
 /// Prepend the specified secret text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="argument">The secret argument to be prepended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder PrependSecret(this ProcessArgumentBuilder builder, IProcessArgument argument)
 {
     builder?.Prepend(new SecretArgument(argument));
     return(builder);
 }
Esempio n. 6
0
 /// <summary>
 /// Prepends the specified secret text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="text">The secret text to be prepended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder PrependSecret(this ProcessArgumentBuilder builder, string text)
 {
     builder?.Prepend(new SecretArgument(new TextArgument(text)));
     return(builder);
 }
Esempio n. 7
0
 /// <summary>
 /// Quotes and prepends the specified text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="switch">The switch preceding the text.</param>
 /// <param name="separator">The separator between the switch and argument.</param>
 /// <param name="text">The text to be quoted and prepended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder PrependSwitchQuoted(this ProcessArgumentBuilder builder, string @switch, string separator, string text)
 {
     builder?.Prepend(new SwitchArgument(@switch, new QuotedArgument(new TextArgument(text)), separator));
     return(builder);
 }
Esempio n. 8
0
 /// <summary>
 /// Quotes and prepends the specified argument to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="argument">The argument to be quoted and prepended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder PrependQuoted(this ProcessArgumentBuilder builder, IProcessArgument argument)
 {
     builder?.Prepend(new QuotedArgument(argument));
     return(builder);
 }
Esempio n. 9
0
 /// <summary>
 /// Quotes and prepends the specified text to the argument builder.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="text">The text to be quoted and prepended.</param>
 /// <returns>The same <see cref="ProcessArgumentBuilder"/> instance so that multiple calls can be chained.</returns>
 public static ProcessArgumentBuilder?PrependQuoted(this ProcessArgumentBuilder builder, string text)
 {
     builder?.Prepend(new QuotedArgument(new TextArgument(text)));
     return(builder);
 }