Пример #1
0
        public bool MoveNext()
        {
            if (_fileSizeCurrent >= _fileSizeMax)
            {
                return(false);
            }

            if (_rowCurrentEnumerator.MoveNext() == false)
            {
                return(false);
            }

            var line = _rowCurrentEnumerator.Current;

            // create last line manually, because text size is constant
            if (_fileSizeCurrent + line.GetSizeInBytes() > _fileSizeMax - _rowGenerator.GetRowMinSize())
            {
                line = _rowGenerator.GenerateRow(_fileSizeMax - _fileSizeCurrent);
            }

            _current = line;

            _fileSizeCurrent += _current.GetSizeInBytes();
            return(true);
        }
Пример #2
0
        public Coupon GenerateCoupon()
        {
            var coupon = new Coupon();

            coupon.CreationDate = DateTimeOffset.Now;

            var rowCount = _configuration.RowsInCoupon;
            var rows     = new Row[rowCount];

            for (var i = 0; i < rowCount; i++)
            {
                rows[i] = _rowGenerator.GenerateRow();
            }

            coupon.Rows = rows;

            return(coupon);
        }