public void AcceptsDateTimeOffsetValueReturnsExpectedResult(int length, DbaseCharacterOptions options, DateTimeOffset value, bool accepted)
        {
            var sut = new DbaseCharacter(
                DbaseField.CreateCharacterField(
                    _fixture.Create <DbaseFieldName>(),
                    new DbaseFieldLength(length)
                    ), options: options);

            var result = sut.AcceptsValue(value);

            Assert.Equal(accepted, result);
        }
        public void AcceptsStringValueReturnsExpectedResult(int length, string value, bool accepted)
        {
            var sut = new DbaseCharacter(
                DbaseField.CreateCharacterField(
                    _fixture.Create <DbaseFieldName>(),
                    new DbaseFieldLength(length)
                    ));

            var result = sut.AcceptsValue(value);

            Assert.Equal(accepted, result);
        }
        public void TryGetValueAsDateTimeOffsetReturnsExpectedResult(int length, DbaseCharacterOptions options, string value, bool gotten, DateTimeOffset gottenValueAsDateTimeOffset)
        {
            var sut = new DbaseCharacter(
                DbaseField.CreateCharacterField(
                    _fixture.Create <DbaseFieldName>(),
                    new DbaseFieldLength(length)
                    ), value, options);

            var result = sut.TryGetValueAsDateTimeOffset(out var valueAsDateTime);

            Assert.Equal(gotten, result);
            Assert.Equal(gottenValueAsDateTimeOffset, valueAsDateTime);
        }
        public void TrySetValueAsNullableDateTimeOffsetReturnsExpectedResult(int length, DbaseCharacterOptions options,
                                                                             DateTimeOffset?value, bool expected)
        {
            var sut = new DbaseCharacter(
                DbaseField.CreateCharacterField(
                    _fixture.Create <DbaseFieldName>(),
                    new DbaseFieldLength(length)
                    ), options: options);

            var result = sut.TrySetValueAsNullableDateTimeOffset(value);

            Assert.Equal(expected, result);
        }
        public void CreateStringFieldReturnsExpectedResult()
        {
            var name   = _fixture.Create <DbaseFieldName>();
            var length = _fixture.Create <DbaseFieldLength>();

            var result = DbaseField.CreateCharacterField(
                name,
                length);

            Assert.Equal(name, result.Name);
            Assert.Equal(DbaseFieldType.Character, result.FieldType);
            Assert.Equal(ByteOffset.Initial, result.Offset);
            Assert.Equal(length, result.Length);
            Assert.Equal(new DbaseDecimalCount(0), result.DecimalCount);
            Assert.Equal(new DbaseIntegerDigits(0), result.PositiveIntegerDigits);
            Assert.Equal(new DbaseIntegerDigits(0), result.NegativeIntegerDigits);
        }
        public void SetValueAsNullableDateTimeOffsetReturnsExpectedResult(int length, DbaseCharacterOptions options,
                                                                          DateTimeOffset?value, bool expected)
        {
            var sut = new DbaseCharacter(
                DbaseField.CreateCharacterField(
                    _fixture.Create <DbaseFieldName>(),
                    new DbaseFieldLength(length)
                    ), options: options);

            if (!expected)
            {
                Assert.Throws <FormatException>(() =>
                {
                    sut.ValueAsNullableDateTimeOffset = value;
                });
            }
            else
            {
                sut.ValueAsNullableDateTimeOffset = value;
            }
        }
        public void GetValueAsNullableDateTimeOffsetReturnsExpectedResult(int length, DbaseCharacterOptions options,
                                                                          string value, bool gotten, DateTimeOffset?gottenValueAsDateTimeOffset)
        {
            var sut = new DbaseCharacter(
                DbaseField.CreateCharacterField(
                    _fixture.Create <DbaseFieldName>(),
                    new DbaseFieldLength(length)
                    ), value, options);

            if (!gotten)
            {
                Assert.Throws <FormatException>(() =>
                {
                    var _ = sut.ValueAsNullableDateTimeOffset;
                });
            }
            else
            {
                var result = sut.ValueAsNullableDateTimeOffset;
                Assert.Equal(gottenValueAsDateTimeOffset, result);
            }
        }