Esempio n. 1
0
        public void commandLine_tryGetValue_using_valid_args_should_return_expected_value()
        {
            var expectedValue = 1000;

            var target = new CommandLine( new[] { "-d=1000" } );

            Int32 value;
            Boolean actual = target.TryGetValue<Int32>( "d", out value );

            actual.Should().Be.True();
            value.Should().Be.EqualTo( expectedValue );
        }
Esempio n. 2
0
        public void commandLine_tryGetValue_using_nullable_as_expected_value_and_missing_parameter_should_return_null()
        {
            var target = new CommandLine( new String[ 0 ] );

            Int32? v;
            Boolean actual = target.TryGetValue<Int32?>( "xyz", out v );

            actual.Should().Be.False();
            v.HasValue.Should().Be.False();
        }
Esempio n. 3
0
        public void commandLine_tryGetValue_using_empty_args_should_not_fail()
        {
            var expected = false;

            var target = new CommandLine( new String[ 0 ] );

            Int32 v;
            Boolean actual = target.TryGetValue<Int32>( "xyz", out v );

            actual.Should().Be.EqualTo( expected );
        }
Esempio n. 4
0
        public void CommandLine_using_valid_source_with_equals_in_the_parameter_value_should_handle_value_as_expected()
        {
            var target = new CommandLine( new[] { "-s=foo=bar" } );
            
            String actual;
            target.TryGetValue( "s", out actual );

            actual.Should().Be.EqualTo( "foo=bar" );
        }
Esempio n. 5
0
        public void commandLine_tryGetValue_using_invalid_format_input_value_should_not_fail()
        {
            var target = new CommandLine( new[] { "xyz=1_0" } );

            Int32 v;
            Boolean actual = target.TryGetValue<Int32>( "xyz", out v );

            actual.Should().Be.False();
        }
Esempio n. 6
0
        public void commandLine_tryGetValue_using_nullable_as_expected_value_and_valid_parameter_should_return_expected_value()
        {
            var expected = new Nullable<Int32>( 10 );
            var target = new CommandLine( new[] { "xyz=10" } );

            Int32? v;
            Boolean actual = target.TryGetValue<Int32?>( "xyz", out v );

            actual.Should().Be.True();
            v.Should().Be.EqualTo( expected );
        }