Add tests for HdHomerunHost.TryGetTunerHostInfo

This commit is contained in:
Bond_009 2020-12-09 01:24:30 +01:00
parent 514d95e5aa
commit c0fde3496c
2 changed files with 13 additions and 1 deletions

View File

@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return list;
}
private async Task<TunerHostInfo> TryGetTunerHostInfo(string url, CancellationToken cancellationToken)
internal async Task<TunerHostInfo> TryGetTunerHostInfo(string url, CancellationToken cancellationToken)
{
var hostInfo = new TunerHostInfo
{
@ -725,6 +725,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
hostInfo.DeviceId = modelInfo.DeviceID;
hostInfo.FriendlyName = modelInfo.FriendlyName;
hostInfo.TunerCount = modelInfo.TunerCount;
return hostInfo;
}

View File

@ -119,5 +119,16 @@ namespace Jellyfin.Server.Implementations.Tests.LiveTv
Assert.True(channels[0].Favorite);
Assert.Equal("http://192.168.1.111:5004/auto/v4.1", channels[0].URL);
}
[Fact]
public async Task TryGetTunerHostInfo_Valid_Success()
{
var host = await _hdHomerunHost.TryGetTunerHostInfo(TestIp, CancellationToken.None).ConfigureAwait(false);
Assert.Equal(_hdHomerunHost.Type, host.Type);
Assert.Equal(TestIp, host.Url);
Assert.Equal("HDHomeRun PRIME", host.FriendlyName);
Assert.Equal("FFFFFFFF", host.DeviceId);
Assert.Equal(3, host.TunerCount);
}
}
}