public void SetNullBehavesAsExpectedForVariableLengthColumn()
        {
            const int zeroLength = 0;

            var sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, AnyValidLengthWillDo, BindingFlags.VariableLengthOut);

            Assert.AreEqual(IndicatorLength, sut.IndicatorLength);

            sut.SetLength(AnyValidLengthWillDo);

            Assert.AreEqual(AnyValidLengthWillDo, GetIndicator(sut));

            sut.SetNull();

            Assert.AreEqual(zeroLength, GetIndicator(sut));
        }
        public void SetNullBehavesAsExpectedForNullableColumn()
        {
            var sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, AnyValidLengthWillDo, BindingFlags.Nullable);

            Assert.AreEqual(IndicatorLength, sut.IndicatorLength);

            sut.SetLength(AnyValidLengthWillDo);

            Assert.AreEqual(AnyValidLengthWillDo, GetIndicator(sut));

            sut.SetNull();

            Assert.AreEqual(Constants.SqlNullData, GetIndicator(sut));
        }
        public void SetLengthThrowsExceptionWhenIndexOutOfRange()
        {
            var sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, AnyValidLengthWillDo, BindingFlags.Nullable);

            TestHelper.AssertThrows<ArgumentOutOfRangeException>(() => sut.SetLength(-1));
            TestHelper.AssertThrows<ArgumentOutOfRangeException>(() => sut.SetLength(AnyValidLengthWillDo + 1));
        }
        public void SetLengthThrowsExceptionWhenIndicatorNotPresent()
        {
            var sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, AnyValidLengthWillDo, BindingFlags.None);

            sut.SetLength(AnyValidLengthWillDo);
        }
        public void SetLengthBehavesAsExpected()
        {
            const int maxLength = 8000;
            const int minValue = 1;
            const int maxValue = maxLength;

            var sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, maxLength, BindingFlags.Nullable);

            Assert.AreEqual(IndicatorLength, sut.IndicatorLength);

            sut.SetLength(minValue);

            Assert.AreEqual(minValue, GetIndicator(sut));

            sut.SetLength(maxValue);

            Assert.AreEqual(maxValue, GetIndicator(sut));
        }