예제 #1
0
        public void String_iteration()
        {
            const string valueOne = "one";
            const string valueTwo = "two";
            const string valueThree = "three";

            string[] values = { valueOne, valueTwo, valueThree };
            IArgumentEnumerator e = new StringArrayEnumerator(values);
            e.MoveNext();

            e.Current.Should().Be(valueOne);
            e.Next.Should().Be(valueTwo);
            e.IsLast.Should().BeFalse();

            e.MoveNext();

            e.Current.Should().Be(valueTwo);
            e.Next.Should().Be(valueThree);
            e.IsLast.Should().BeFalse();

            e.MoveNext();

            e.Current.Should().Be(valueThree);
            e.Next.Should().BeNull();
            e.IsLast.Should().BeTrue();
        }
예제 #2
0
        public void Get_next_input_values()
        {
            var ae = new StringArrayEnumerator(new string[] { "--optarr", "one", "two", "--plain", "3" });

            ae.MoveNext(); // skip first, working like in a real case

            var items = ArgumentParser.InternalWrapperOfGetNextInputValues(ae);

            base.ElementsShouldBeEqual(new string[] { "one", "two" }, items);
            ae.Current.Should().Be("two");
        }