Files
ChanSort/source/Test.Loader.VDR/LinuxVdrTest.cs
hbeham 0cf97fe76c - UHD channels using ServiceType 0x9F are now recognized as TV channels (fixes an issue with Panasonic lists where these channels did not show up and their numbers were assigned multiple times)
- ChannelList.SignalSource and DataRoot.GetChannelList(SignalSource) are now handled so that if all bits of a given Mask are left 0, the list will accept anything.
  i.e. if Tv/Radio/Data is left 0, the list can contain all of them as well as channels that have neither of the 3 bits set.
- added basic unit tests for each loader to ensure test files have the expected numbers of channels in the various sub lists
2019-08-29 16:57:20 +02:00

51 lines
1.4 KiB
C#

using System;
using System.IO;
using System.Linq;
using System.Reflection;
using ChanSort.Api;
using ChanSort.Loader.VDR;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Test.Loader.VDR
{
[TestClass]
public class LinuxVdrTest
{
private static readonly string filesDir;
static LinuxVdrTest()
{
filesDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\TestFiles\\";
}
#region TestAstraChannelsAddedToCorrectLists
[TestMethod]
public void TestAstraChannelsAddedToCorrectLists()
{
this.TestChannelsAddedToCorrectLists("channels.conf", 3380, 2649, 492);
}
#endregion
#region TestChannelsAddedToCorrectList
private void TestChannelsAddedToCorrectLists(string fileName, int expectedTotal, int expectedTv, int expectedRadio)
{
var plugin = new SerializerPlugin();
var ser = plugin.CreateSerializer(filesDir + fileName);
ser.Load();
var root = ser.DataRoot;
var list = root.ChannelLists.FirstOrDefault();
Assert.IsNotNull(list);
Assert.AreEqual(expectedTotal, list.Channels.Count);
Assert.AreEqual(expectedTv, list.Channels.Count(ch => (ch.SignalSource & SignalSource.Tv) != 0));
Assert.AreEqual(expectedRadio, list.Channels.Count(ch => (ch.SignalSource & SignalSource.Radio) != 0));
// no data channels in channels.conf files
}
#endregion
}
}