mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
Add test for HdHomerunManager.ParseReturnMessage
This commit is contained in:
parent
7fb3a354fd
commit
e8b18e5f8f
@ -355,7 +355,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
return offset + 4;
|
||||
}
|
||||
|
||||
private static bool ParseReturnMessage(byte[] buf, int numBytes, out string returnVal)
|
||||
internal static bool ParseReturnMessage(byte[] buf, int numBytes, out string returnVal)
|
||||
{
|
||||
returnVal = string.Empty;
|
||||
|
||||
|
@ -103,5 +103,23 @@ namespace Jellyfin.Server.Implementations.Tests.LiveTv
|
||||
Convert.ToHexString(expected),
|
||||
Convert.ToHexString(buffer.Slice(0, len)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseReturnMessage_Valid_Success()
|
||||
{
|
||||
ReadOnlySpan<byte> packet = stackalloc byte[]
|
||||
{
|
||||
0, 5,
|
||||
0, 20,
|
||||
3,
|
||||
10, (byte)'/', (byte)'t', (byte)'u', (byte)'n', (byte)'e', (byte)'r', (byte)'0', (byte)'/', (byte)'N', 0,
|
||||
4,
|
||||
6, (byte)'v', (byte)'a', (byte)'l', (byte)'u', (byte)'e', 0,
|
||||
0x7d, 0xa3, 0xa3, 0xf3
|
||||
};
|
||||
|
||||
Assert.True(HdHomerunManager.ParseReturnMessage(packet.ToArray(), packet.Length, out var value));
|
||||
Assert.Equal("value", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user