예제 #1
0
        public void Parse_IntValueAndParameterWithShortName_PropertiesAreSetCorrect()
        {
            const int expectedValue0 = 1234;
            const int expectedValue1 = 4321;

            var args = new[] { "hello", "-j", expectedValue1.ToString(), "-i", expectedValue0.ToString() };

            var parser = new OptionParser(typeof(TestOptionWithInt));

            // Act
            var option = parser.Parse(args) as TestOptionWithInt;

            // Assert
            option
            .Should()
            .NotBeNull();

            option !.IntValue
            .Should()
            .Be(expectedValue0);

            option.IntValue2
            .Should()
            .Be(expectedValue1);

            option.DefIntValue
            .Should()
            .Be(1357);
        }