コード例 #1
0
            public bool MoveNext()
            {
                if (_leftSize <= 0)
                {
                    return(false);
                }

                var current      = _stringFactory.Create();
                var stringSize   = _targetEncoding.GetByteCount(current);
                var nextLeftSize = _leftSize - stringSize - _separatorSize;

                if (nextLeftSize <= _minStringSize)
                {
                    current    = _stringFactory.Create((int)(_leftSize - _separatorSize));
                    stringSize = _targetEncoding.GetByteCount(current);
                }

                _leftSize -= stringSize;
                _leftSize -= _separatorSize;
                Current    = current;
                return(true);
            }
コード例 #2
0
 public void ShouldNotCreateTooSmallString(int length)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => _stringFactory.Create(length));
 }