public void ChecksumValidationExceptionShouldBeThrownIfChecksumIsWrong(byte[] data, byte checksum) { var sut = new OffsetRecord() { Address = 0x0000, ByteCount = 2, Data = data, Checksum = checksum, Type = IntelHexRecordType.ExtendedLinearAddress }; Assert.Throws <ChecksumValidationFailedException>(() => sut.GetBinaryRepresentation(0x0000)); }
public void OffsetRecordShouldFillUpTheOffset(byte[] data, byte checksum, long byteLength, long baseAddress) { var expectedBinaryRepresentation = new byte[byteLength]; for (var i = 0; i < byteLength; i++) { expectedBinaryRepresentation[i] = 0xFF; } var sut = new OffsetRecord() { Address = 0x0000, ByteCount = 2, Data = data, Checksum = checksum, Type = IntelHexRecordType.ExtendedLinearAddress }; var caluclatedBinaryRepresentation = sut.GetBinaryRepresentation((int)baseAddress); Assert.AreEqual(expectedBinaryRepresentation, caluclatedBinaryRepresentation); }