Exemple #1
0
 public FakeDbaseSchema()
 {
     Fields = new[]
     {
         DbaseField.CreateInt32Field(new DbaseFieldName(nameof(Id)), new DbaseFieldLength(4))
     };
 }
        public void CreateInt32FieldReturnsExpectedResult()
        {
            var name   = _fixture.Create <DbaseFieldName>();
            var length = _fixture.Create <DbaseFieldLength>();
            var positiveIntegerDigits = new DbaseIntegerDigits(length.ToInt32());
            var negativeIntegerDigits = positiveIntegerDigits != new DbaseIntegerDigits(0)
                ? positiveIntegerDigits.Minus(new DbaseIntegerDigits(1))
                : new DbaseIntegerDigits(0);
            var result = DbaseField.CreateInt32Field(
                name,
                length);

            Assert.Equal(name, result.Name);
            Assert.Equal(DbaseFieldType.Number, result.FieldType);
            Assert.Equal(ByteOffset.Initial, result.Offset);
            Assert.Equal(length, result.Length);
            Assert.Equal(new DbaseDecimalCount(0), result.DecimalCount);
            Assert.Equal(positiveIntegerDigits, result.PositiveIntegerDigits);
            Assert.Equal(negativeIntegerDigits, result.NegativeIntegerDigits);
        }