Exemplo n.º 1
0
        public void CreateDateTimeFieldValueReturnsExpectedResult()
        {
            var sut = new DbaseField(
                _fixture.Create <DbaseFieldName>(),
                DbaseFieldType.DateTime,
                _fixture.Create <ByteOffset>(),
                new DbaseFieldLength(15),
                new DbaseDecimalCount(0));

            var result = sut.CreateFieldValue();

            Assert.Equal(sut, result.Field);
            Assert.IsType <DbaseDateTime>(result);
        }
        public void CreateFloatFieldValueReturnsExpectedResult()
        {
            var length       = _fixture.GenerateDbaseSingleLength();
            var decimalCount = _fixture.GenerateDbaseSingleDecimalCount(length);
            var sut          = new DbaseField(
                _fixture.Create <DbaseFieldName>(),
                DbaseFieldType.Float,
                _fixture.Create <ByteOffset>(),
                length,
                decimalCount);

            var result = sut.CreateFieldValue();

            Assert.Equal(sut, result.Field);
            Assert.IsType <DbaseFloat>(result);
        }
Exemplo n.º 3
0
        public void CreateNumberFieldValueReturnsExpectedResult()
        {
            var length       = _fixture.GenerateDbaseDoubleLength();
            var decimalCount = _fixture.GenerateDbaseDoubleDecimalCount(length);
            var sut          = new DbaseField(
                _fixture.Create <DbaseFieldName>(),
                DbaseFieldType.Number,
                _fixture.Create <ByteOffset>(),
                length,
                decimalCount);

            var result = sut.CreateFieldValue();

            Assert.Equal(sut, result.Field);
            if (sut.DecimalCount.ToInt32() == 0)
            {
                Assert.IsType <DbaseInt32>(result);
            }
            else
            {
                Assert.IsType <DbaseDouble>(result);
            }
        }