public void Passing_no_value_to_a_nullable_integer_option_fails() { var options = new NullableTypesOptions(); var parser = new CommandLine.Parser(); var result = parser.ParseArguments(new string[] { "-int" }, options); result.Should().BeFalse(); }
public void Parse_nullable_enumeration_option() { var options = new NullableTypesOptions(); var parser = new CommandLine.Parser(); var result = parser.ParseArguments(new string[] { "--enum=ReadWrite" }, options); result.Should().BeTrue(); options.EnumValue.Should().Be(FileAccess.ReadWrite); options = new NullableTypesOptions(); parser = new CommandLine.Parser(); result = parser.ParseArguments(new string[] { }, options); result.Should().BeTrue(); options.EnumValue.Should().BeNull(); }
public void Parse_nullable_double_option() { var options = new NullableTypesOptions(); var parser = new CommandLine.Parser(); var result = parser.ParseArguments(new string[] { "-d9.999" }, options); result.Should().BeTrue(); options.DoubleValue.Should().Be(9.999); options = new NullableTypesOptions(); parser = new CommandLine.Parser(); result = parser.ParseArguments(new string[] { }, options); result.Should().BeTrue(); options.DoubleValue.Should().NotHaveValue(); }
public void Passing_bad_value_to_a_nullable_enumeration_option_fails() { var options = new NullableTypesOptions(); var parser = new CommandLine.Parser(); var result = parser.ParseArguments(new string[] { "-e", "Overwrite" }, options); result.Should().BeFalse(); }
public void Parse_string_option_and_nullable_value_types() { var options = new NullableTypesOptions(); var parser = new CommandLine.Parser(); var result = parser.ParseArguments(new string[] { "--string", "alone" }, options); result.Should().BeTrue(); options.StringValue.Should().Be("alone"); options = new NullableTypesOptions(); parser = new CommandLine.Parser(); result = parser.ParseArguments( new string[] { "-d1.789", "--int", "10099", "-stogether", "--enum", "Read" }, options); result.Should().BeTrue(); options.DoubleValue.Should().Be(1.789D); options.IntegerValue.Should().Be(10099); options.StringValue.Should().Be("together"); options.EnumValue.Should().Be(FileAccess.Read); }
public void Parse_nullable_integer_option() { var options = new NullableTypesOptions(); var parser = new Parser(); var result = parser.ParseArguments(new string[] { "-i", "99" }, options); result.Should().BeTrue(); options.IntegerValue.Should().Be(99); options = new NullableTypesOptions(); parser = new Parser(); result = parser.ParseArguments(new string[] { }, options); result.Should().BeTrue(); options.IntegerValue.Should().NotHaveValue(); }
public void Passing_no_value_to_a_nullable_enumeration_option_fails() { var options = new NullableTypesOptions(); var parser = new Parser(); var result = parser.ParseArguments(new string[] { "--enum" }, options); result.Should().BeFalse(); }
public void Passing_bad_value_to_a_nullable_double_option_fails() { var options = new NullableTypesOptions(); var parser = new Parser(); var result = parser.ParseArguments(new string[] { "--double", "9,999" }, options); result.Should().BeFalse(); }