mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-01-26 00:59:03 +01:00
- 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
60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using ChanSort.Api;
|
|
using ChanSort.Loader.Hisense2017;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
namespace Test.Loader.Hisense2017
|
|
{
|
|
[TestClass]
|
|
public class HisenseServicelistDbTest
|
|
{
|
|
private static readonly string filesDir;
|
|
|
|
static HisenseServicelistDbTest()
|
|
{
|
|
filesDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\TestFiles\\";
|
|
}
|
|
|
|
#region TestAstraChannelsAddedToCorrectLists
|
|
[TestMethod]
|
|
public void TestAstraChannelsAddedToCorrectLists()
|
|
{
|
|
this.TestChannelsAddedToCorrectLists("servicelist.db", "ASTRA1 19.2°E", 1214, 1052, 162);
|
|
}
|
|
#endregion
|
|
|
|
#region TestEutelsatChannelsAddedToCorrectLists
|
|
[TestMethod]
|
|
public void TesEutelsatChannelsAddedToCorrectLists()
|
|
{
|
|
this.TestChannelsAddedToCorrectLists("servicelist.db", "Hot Bird 13°E", 1732, 1439, 293);
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region TestChannelsAddedToCorrectList
|
|
private void TestChannelsAddedToCorrectLists(string fileName, string listCaption, int expectedTotal, int expectedTv, int expectedRadio)
|
|
{
|
|
var plugin = new HisDbSerializerPlugin();
|
|
var ser = plugin.CreateSerializer(filesDir + fileName);
|
|
ser.Load();
|
|
|
|
var root = ser.DataRoot;
|
|
|
|
var list = root.ChannelLists.FirstOrDefault(l => l.Caption.StartsWith(listCaption));
|
|
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 Hisense/Loewe servicelist.db files
|
|
}
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|