コード例 #1
0
 public void WhenFlagsMissing_DoesNotPrompt()
 {
     new AppRunner <App>()
     .UseArgumentPrompter()
     .Verify(new Scenario
     {
         When =
         {
             Args     = $"{nameof(App.Flags)}",
             OnPrompt = Respond.FailOnPrompt()
         },
         Then = { Output = "" }
     });
 }
コード例 #2
0
        public void PipedInputIsEvaluatedBeforePrompting()
        {
            var pipedInput = new[] { "a", "b", "c" };

            new AppRunner <App>()
            .UseArgumentPrompter()
            .Verify(new Scenario
            {
                When =
                {
                    Args       = $"{nameof(App.DoList)}",
                    PipedInput = pipedInput,
                    OnPrompt   = Respond.FailOnPrompt()
                },
                Then = { AssertContext = ctx => ctx.ParamValuesShouldBe(pipedInput.ToList()) }
            });
        }
コード例 #3
0
 public void When_OptionAndOperand_Missing_DoesNotPrompt_For_NRT_Parameters()
 {
     new AppRunner <App>()
     .UseArgumentPrompter()
     .Verify(new Scenario
     {
         When =
         {
             Args     = $"{nameof(App.Do)}",
             OnPrompt = Respond.FailOnPrompt()
         },
         Then =
         {
             AssertContext = ctx => ctx.ParamValuesShouldBe(null, null)
         }
     });
 }
コード例 #4
0
 public void WhenOperandAndOptionProvided_DoesNotPrompt()
 {
     new AppRunner <App>()
     .UseArgumentPrompter()
     .Verify(new Scenario
     {
         When =
         {
             Args     = $"{nameof(App.Do)} something --opt1 simple",
             OnPrompt = Respond.FailOnPrompt()
         },
         Then =
         {
             AssertContext = ctx => ctx.ParamValuesShouldBe("simple", "something"),
             Output        = ""
         }
     });
 }