Beispiel #1
0
        private char[] GeneratePositiveNumber(DbaseIntegerDigits digits, DbaseDecimalCount decimals)
        {
            var data = new char[digits.ToInt32() + 1 + decimals.ToInt32()];

            for (var index = 0; index < digits.ToInt32(); index++)
            {
                data[index] = _random.Next(0, 10).ToString()[0];
            }
            data[digits.ToInt32()] = '.';
            for (var index = 0; index < decimals.ToInt32(); index++)
            {
                data[digits.ToInt32() + 1 + index] = _random.Next(0, 10).ToString()[0];
            }
            return(data);
        }
        public void ToLengthReturnsExpectedValue()
        {
            var value = _fixture.Create <int>().AsDbaseFieldCompatibleDbaseIntegerDigitsValue();
            var sut   = new DbaseIntegerDigits(value);

            var result = sut.ToLength();

            Assert.Equal(new DbaseFieldLength(sut.ToInt32()), result);
        }
        public void ToInt32ReturnsExpectedValue()
        {
            var value = _fixture.Create <int>().AsDbaseIntegerDigitsValue();
            var sut   = new DbaseIntegerDigits(value);

            var result = sut.ToInt32();

            Assert.Equal(value, result);
        }