Beispiel #1
0
        public void Return_No_Consumption_If_Switch_Does_Not_Match()
        {
            // arrange
            var switch0 = new TestSwitch(new Parser("a"), 't', "test", (o, strings) => { });
            var info    = new IterationInfo("-x a b c d e d f g".Split(' '));

            // act
            var result = switch0.CanConsume("", info);

            // assert
            result.NumConsumed.Should().Be(0);
        }
Beispiel #2
0
        public void Return_No_Consumption_If_Minimum_Number_Of_Values_Are_Not_Met()
        {
            // arrange
            var switch0 = new TestSwitch(new Parser("a"), 't', "test", (o, strings) => { })
            {
                MinRequired = 50
            };
            var info = new IterationInfo("-t a b c d e d f g".Split(' '));

            // act
            var result = switch0.CanConsume("", info);

            // assert
            result.NumConsumed.Should().Be(0);
        }
Beispiel #3
0
        public void Indicate_It_Can_Consume_The_Max_Allowed_When_Current_Arg_Is_A_Match()
        {
            // arrange
            var switch0 = new TestSwitch(new Parser("a"), 't', "test", (o, strings) => { })
            {
                MaxAllowed = 3
            };
            var info = new IterationInfo("-t a b c d e d f g".Split(' '));

            // act
            // assert
            var result = switch0.CanConsume("", info);

            result.NumConsumed.Should().Be(3);
            result.Info.Current.Should().Be("c");
        }