Skip to content

Commit

Permalink
Fixed broken BinaryMapper tests for mapmessages methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
numinnex committed Aug 23, 2023
1 parent bded5da commit 737240c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Iggy_SDK_Tests/MapperTests/BinaryMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void MapOffsets_ReturnsValidOffsetResponse()
Assert.Equal(offset, response.Offset);
}

[Fact(Skip = "Broken test")]
[Fact]
public void MapMessagesTMessage_NoHeaders_ReturnsValidMessageResponse()
{
//Arrange
Expand Down
6 changes: 3 additions & 3 deletions Iggy_SDK_Tests/Utils/BinaryFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ internal static byte[] CreateOffsetPayload(int consumerId, int offset)
internal static byte[] CreateMessagePayload(ulong offset, ulong timestamp,int headersLength,uint checkSum, Guid guid, ReadOnlySpan<byte> payload)
{
var messageLength = payload.Length;
var totalSize = 44 + payload.Length;
var totalSize = 45 + payload.Length;
var payloadBuffer = new byte[totalSize];


BinaryPrimitives.WriteUInt64LittleEndian(payloadBuffer, (ulong)offset);
payloadBuffer.AsSpan()[8] = 10;
payloadBuffer.AsSpan()[8] = (byte)10;
BinaryPrimitives.WriteUInt64LittleEndian(payloadBuffer.AsSpan(9), (ulong)timestamp);
var idBytes = guid.ToByteArray();
idBytes.CopyTo(payloadBuffer.AsSpan()[17..33]);
BinaryPrimitives.WriteUInt32LittleEndian(payloadBuffer.AsSpan(33), (uint)checkSum);
BinaryPrimitives.WriteUInt32LittleEndian(payloadBuffer.AsSpan(37), (uint)headersLength);
BinaryPrimitives.WriteUInt32LittleEndian(payloadBuffer.AsSpan(41), (uint)messageLength);
payload.CopyTo(payloadBuffer.AsSpan(44));
payload.CopyTo(payloadBuffer.AsSpan(45));
return payloadBuffer;
}

Expand Down

0 comments on commit 737240c

Please sign in to comment.