public void CharIteration()
        {
            IArgumentEnumerator e = new OneCharStringEnumerator("abcd");
            e.MoveNext();

            e.Current.Should().Equal("a");
            e.Next.Should().Equal("b");
            e.GetRemainingFromNext().Should().Equal("bcd");
            e.IsLast.Should().Be.False();

            e.MoveNext();

            e.Current.Should().Equal("b");
            e.Next.Should().Equal("c");
            e.GetRemainingFromNext().Should().Equal("cd");
            e.IsLast.Should().Be.False();

            e.MoveNext();

            e.Current.Should().Equal("c");
            e.Next.Should().Equal("d");
            e.GetRemainingFromNext().Should().Equal("d");
            e.IsLast.Should().Be.False();

            e.MoveNext();

            e.Current.Should().Equal("d");
            e.IsLast.Should().Be.True();
        }
        public override Internal.ParserState Parse(IArgumentEnumerator argumentEnumerator, OptionMap map, object options)
        {
            IArgumentEnumerator group = new OneCharStringEnumerator(argumentEnumerator.Current.Substring(1));
            while (group.MoveNext())
            {
                var option = map[group.Current];
                if (option == null)
                {
                    return _ignoreUnkwnownArguments ? Internal.ParserState.MoveOnNextElement : Internal.ParserState.Failure;
                }
                option.IsDefined = true;

                ArgumentParser.EnsureOptionArrayAttributeIsNotBoundToScalar(option);

                if (!option.IsBoolean)
                {
                    if (argumentEnumerator.IsLast && group.IsLast)
                    {
                        return ParserState.Failure;
                    }
                    bool valueSetting;
                    if (!group.IsLast)
                    {
                        if (!option.IsArray)
                        {
                            valueSetting = option.SetValue(group.GetRemainingFromNext(), options);
                            if (!valueSetting)
                            {
                                DefineOptionThatViolatesFormat(option);
                            }
                            return ArgumentParser.BooleanToParserState(valueSetting);
                        }

                        ArgumentParser.EnsureOptionAttributeIsArrayCompatible(option);

                        var items = ArgumentParser.GetNextInputValues(argumentEnumerator);
                        items.Insert(0, @group.GetRemainingFromNext());

                        valueSetting = option.SetValue(items, options);
                        if (!valueSetting)
                        {
                            DefineOptionThatViolatesFormat(option);
                        }
                        return ArgumentParser.BooleanToParserState(valueSetting, true);
                    }

                    if (!argumentEnumerator.IsLast && !ArgumentParser.IsInputValue(argumentEnumerator.Next))
                    {
                        return Internal.ParserState.Failure;
                    }
                    else
                    {
                        if (!option.IsArray)
                        {
                            valueSetting = option.SetValue(argumentEnumerator.Next, options);
                            if (!valueSetting)
                            {
                                this.DefineOptionThatViolatesFormat(option);
                            }
                            return ArgumentParser.BooleanToParserState(valueSetting, true);
                        }

                        ArgumentParser.EnsureOptionAttributeIsArrayCompatible(option);

                        var items = ArgumentParser.GetNextInputValues(argumentEnumerator);

                        valueSetting = option.SetValue(items, options);
                        if (!valueSetting)
                        {
                            DefineOptionThatViolatesFormat(option);
                        }
                        return ArgumentParser.BooleanToParserState(valueSetting);
                    }
                }

                if ([email protected] && map[@group.Next] == null)
                {
                    return Internal.ParserState.Failure;
                }
                if (!option.SetValue(true, options))
                {
                    return Internal.ParserState.Failure;
                }
            }

            return Internal.ParserState.Success;
        }