public void CopyFromThrowsExceptionWhenBytesIsNull() { var sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, AnyValidLengthWillDo, BindingFlags.None); sut.CopyFrom(null, AnyValidLengthWillDo); }
public void CopyFromThrowsExceptionWhenIndexLessThanZero() { var sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, AnyValidLengthWillDo, BindingFlags.None); sut.CopyFrom(new byte[AnyValidLengthWillDo], -1); }
public void CopyFromBehavesAsExpected() { const int dataTypeLengthInBytes = 4; var bytes = new byte[] {0, 128, 255}; var sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, dataTypeLengthInBytes, BindingFlags.None); Assert.AreEqual(0, sut.IndicatorLength); sut.CopyFrom(bytes, 0); VerifyCopiedBytes(bytes, sut); sut = new StandardDataTypeImpl(AnyValidIndexWillDo, AnyBulkCopyDataTypeWillDo, dataTypeLengthInBytes, BindingFlags.Nullable); Assert.AreEqual(IndicatorLength, sut.IndicatorLength); sut.CopyFrom(bytes, 0); Assert.AreEqual(bytes.Length, GetIndicator(sut)); VerifyCopiedBytes(bytes, sut); }