Beispiel #1
0
 public async Task DependenciesNotRegisteredAreNulls()
 {
     await AppTest.Run(Command.Name, output =>
     {
         output.AssertLength(0);
     });
 }
Beispiel #2
0
 public async Task Success()
 {
     await AppTest.Run(Command.Name, output =>
     {
         output.AssertView();
     });
 }
Beispiel #3
0
 public async Task Success()
 {
     await AppTest.Run(Command.Name, output =>
     {
         output.AssertDefaultUsage();
     });
 }
Beispiel #4
0
 public async Task NoDependenciesRegistered()
 {
     await AppTest.Run(Command.Name, output =>
     {
         output.AssertLength(0);
     });
 }
Beispiel #5
0
 public async Task InOrder_Success()
 {
     var args = $"{Command.Name} 0.47 value-1 47 string-value";
     await AppTest.Run(args, output =>
     {
         output.AssertArguments(0.47, EnumValues.Value1, 47, "string-value");
     });
 }
Beispiel #6
0
 public async Task OrderDoesntMatter_Success()
 {
     var args = $"{Command.Name} --enum value-1 --string string-value --bool --integer 47 --double 0.47";
     await AppTest.Run(args, output =>
     {
         output.AssertArguments(true, 0.47, EnumValues.Value1, 47, "string-value");
     });
 }
Beispiel #7
0
 public async Task Many_FirstDouble_OnlyFirstRead()
 {
     var args = $"{Command.Name} --double 0.47 any values 1 2 3";
     await AppTest.Run(args, output =>
     {
         output.AssertOption(0.47);
     });
 }
Beispiel #8
0
 public async Task NoOption_DefaultValue()
 {
     var args = Command.Name;
     await AppTest.Run(args, output =>
     {
         output.AssertOption(0);
     });
 }
Beispiel #9
0
 public async Task SingleWord_InQuotationMarks()
 {
     var args = $"{Command.Name} --string \"value\"";
     await AppTest.Run(args, output =>
     {
         output.AssertOption("value");
     });
 }
Beispiel #10
0
 public async Task ManyWords_WithoutQuotationMarks_OnlyFirstRead()
 {
     var args = $"{Command.Name} --string value1 value2";
     await AppTest.Run(args, output =>
     {
         output.AssertOption("value1");
     });
 }
Beispiel #11
0
 public async Task Single_NotDouble_ErrorMessage()
 {
     var args = $"{Command.Name} not-double";
     await AppTest.Run(args, output =>
     {
         output.AssertParsingException("double", "not-double");
     });
 }
Beispiel #12
0
 public async Task Single_WithCommaSeparator_Succcess()
 {
     var args = $"{Command.Name} 0,47";
     await AppTest.Run(args, output =>
     {
         output.AssertArgument(0.47);
     });
 }
Beispiel #13
0
 public async Task DefaultUsage()
 {
     var args = Command.Name;
     await AppTest.Run(args, output =>
     {
         output.AssertArgument(0);
     });
 }
Beispiel #14
0
 public async Task Exists_WithInputValue_InputValueIgnoredAndTrueAsResult()
 {
     var args = $"{Command.Name} --bool value1 value2";
     await AppTest.Run(args, output =>
     {
         output.AssertOption(true);
     });
 }
Beispiel #15
0
 public async Task Exists_WithoutInputValue_TrueValue()
 {
     var args = $"{Command.Name} --bool";
     await AppTest.Run(args, output =>
     {
         output.AssertOption(true);
     });
 }
Beispiel #16
0
 public async Task InOrder_TooManyArguments_ExcessiveArgumentsSkipped()
 {
     var args = $"{Command.Name} 0.47 value-1 47 string-value more values 1 2 3 4.5";
     await AppTest.Run(args, output =>
     {
         output.AssertArguments(0.47, EnumValues.Value1, 47, "string-value");
     });
 }
Beispiel #17
0
 public async Task SingleWord()
 {
     var args = $"{Command.Name} --string value";
     await AppTest.Run(args, output =>
     {
         output.AssertOption("value");
     });
 }
Beispiel #18
0
 public async Task NumericValue()
 {
     var args = $"{Command.Name} 47";
     await AppTest.Run(args, output =>
     {
         output.AssertArgument("47");
     });
 }
Beispiel #19
0
 public async Task ManyWords_InQuotationMarks_ReadAsOneValue()
 {
     var args = $"{Command.Name} --string \"value1 value2\"";
     await AppTest.Run(args, output =>
     {
         output.AssertOption("value1 value2");
     });
 }
Beispiel #20
0
 public async Task DotSeparator_Success()
 {
     var args = $"{Command.Name} --integer 47";
     await AppTest.Run(args, output =>
     {
         output.AssertOption(47);
     });
 }
Beispiel #21
0
 public async Task NumericValue()
 {
     var args = $"{Command.Name} --string 47";
     await AppTest.Run(args, output =>
     {
         output.AssertOption("47");
     });
 }
Beispiel #22
0
 public async Task Many_FirstInteger_OnlyFirstRead()
 {
     var args = $"{Command.Name} --integer 47 any values 1 2 3";
     await AppTest.Run(args, output =>
     {
         output.AssertOption(47);
     });
 }
Beispiel #23
0
 public async Task CommaSeparator_Success()
 {
     var args = $"{Command.Name} --double 0,47";
     await AppTest.Run(args, output =>
     {
         output.AssertOption(0.47);
     });
 }
Beispiel #24
0
 public async Task Many_FirstNotInteger_ThrowsException()
 {
     var args = $"{Command.Name} --integer not-integer 47 any values 1 2 3";
     await AppTest.Run(args, output =>
     {
         output.AssertParsingException("--integer", "not-integer");
     });
 }
Beispiel #25
0
 public async Task Many_FirstNotDouble_ErrorMessage()
 {
     var args = $"{Command.Name} --double not-double 0.47 any values 1 2 3";
     await AppTest.Run(args, output =>
     {
         output.AssertParsingException("--double", "not-double");
     });
 }
Beispiel #26
0
 public async Task Single_NotEnum_ErrorMessage()
 {
     var args = $"{Command.Name} not-enum-value";
     await AppTest.Run(args, output =>
     {
         output.AssertParsingException("enum", "not-enum-value");
     });
 }
Beispiel #27
0
 public async Task NoOptions_DefaultValues()
 {
     var args = Command.Name;
     await AppTest.Run(args, output =>
     {
         output.AssertArguments(false, 0, EnumValues.None, 0, null);
     });
 }
Beispiel #28
0
 public async Task Many_FirstNotEnum_ErrorMessage()
 {
     var args = $"{Command.Name} any value-1 1 2 3";
     await AppTest.Run(args, output =>
     {
         output.AssertParsingException("enum", "any");
     });
 }
Beispiel #29
0
 public async Task NotRecognizedOptionsSkipped()
 {
     var args = $"{Command.Name} --bool --double 0.47 --enum value-1 --integer 47 --string string-value --other-option some-value";
     await AppTest.Run(args, output =>
     {
         output.AssertArguments(true, 0.47, EnumValues.Value1, 47, "string-value");
     });
 }
Beispiel #30
0
 public async Task Many_FirstNotInteger_ErrorMessage()
 {
     var args = $"{Command.Name} string 1 2 3";
     await AppTest.Run(args, output =>
     {
         output.AssertParsingException("integer", "string");
     });
 }