public void CopyInt64ThrowsExceptionWhenIndexOutOfRange() { const int dataTypeLengthInBytes = 8; const long anyValueWillDo = 1; var sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, dataTypeLengthInBytes, BindingFlags.None); TestHelper.AssertThrows<ArgumentOutOfRangeException>(() => sut.CopyInt64(-1, anyValueWillDo)); TestHelper.AssertThrows<ArgumentOutOfRangeException>(() => sut.CopyInt64(dataTypeLengthInBytes, anyValueWillDo)); }
public void CopyInt64BehavesAsExpected() { const int dataTypeLengthInBytes = 8; const long minValue = long.MinValue; const long maxValue = long.MaxValue; var sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, dataTypeLengthInBytes, BindingFlags.None); Assert.AreEqual(0, sut.IndicatorLength); sut.CopyInt64(0, minValue); Assert.AreEqual(minValue, BitConverter.ToInt64(sut.Data, sut.IndicatorLength)); sut.CopyInt64(0, maxValue); Assert.AreEqual(maxValue, BitConverter.ToInt64(sut.Data, sut.IndicatorLength)); sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, dataTypeLengthInBytes, BindingFlags.Nullable); Assert.AreEqual(IndicatorLength, sut.IndicatorLength); sut.CopyInt64(0, minValue); Assert.AreEqual(minValue, BitConverter.ToInt64(sut.Data, sut.IndicatorLength)); sut.CopyInt64(0, maxValue); Assert.AreEqual(maxValue, BitConverter.ToInt64(sut.Data, sut.IndicatorLength)); }