Skip to content

Commit

Permalink
Missing test case for nullable string encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Havret committed Mar 3, 2024
1 parent 8de7546 commit d14f85b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/ArtemisNetCoreClient.Tests/ByteBufferTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,17 @@ public void should_long_string()
CollectionAssert.AreEqual(expected, byteBuffer.GetBuffer().ToArray());
}

[Test]
public void should_nullable_string()
[TestCase("abcdefgh", new byte[] { 1, 0, 0, 0, 8, 0, 97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0, 103, 0, 104 })]
[TestCase(null, new byte[] { 0 })]
public void should_nullable_string(string value, byte[] encoded)
{
// Arrange
var byteBuffer = new ByteBuffer();

// Act
byteBuffer.WriteNullableString("abcdefgh");
byteBuffer.WriteNullableString(value);

// Assert
var expected = new byte[] { 1, 0, 0, 0, 8, 0, 97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0, 103, 0, 104 };
CollectionAssert.AreEqual(expected, byteBuffer.GetBuffer().ToArray());
CollectionAssert.AreEqual(encoded, byteBuffer.GetBuffer().ToArray());
}
}

0 comments on commit d14f85b

Please sign in to comment.