-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create ColumnCountPayload when metadata are missing. Co-authored-by: Bradley Grainger <[email protected]>
- Loading branch information
Showing
3 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using MySqlConnector.Protocol.Payloads; | ||
|
||
namespace MySqlConnector.Tests; | ||
|
||
public class ColumnCountPayloadTests | ||
{ | ||
[Theory] | ||
[InlineData(new byte[] { 1 }, false, 1, true)] | ||
[InlineData(new byte[] { 1, 1 }, true, 1, true)] | ||
[InlineData(new byte[] { 1, 0 }, true, 1, false)] | ||
[InlineData(new byte[] { 2 }, false, 2, true)] | ||
[InlineData(new byte[] { 2, 1 }, true, 2, true)] | ||
[InlineData(new byte[] { 2, 0 }, true, 2, false)] | ||
[InlineData(new byte[] { 2 }, true, 2, true)] // this seems like invalid data, but a server may return this | ||
public void ParseResultSetHeader(byte[] span, bool supportsOptionalMetadata, int expectedColumnCount, bool expectedMetadataFollows) | ||
{ | ||
var columnCountPayload = ColumnCountPayload.Create(span.AsSpan(), supportsOptionalMetadata); | ||
Assert.Equal(expectedColumnCount, columnCountPayload.ColumnCount); | ||
Assert.Equal(expectedMetadataFollows, columnCountPayload.MetadataFollows); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters