mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-07-06 15:48:12 +02:00
- 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
This commit is contained in:
70
source/Test.Loader.GlobalClone/LgGlobalCloneTest.cs
Normal file
70
source/Test.Loader.GlobalClone/LgGlobalCloneTest.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using ChanSort.Api;
|
||||
using ChanSort.Loader.GlobalClone;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Test.Loader.GlobalClone
|
||||
{
|
||||
[TestClass]
|
||||
public class LgGlobalCloneTest
|
||||
{
|
||||
private static readonly string filesDir;
|
||||
|
||||
static LgGlobalCloneTest()
|
||||
{
|
||||
filesDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\TestFiles\\";
|
||||
}
|
||||
|
||||
#region TestSatChannelsAddedToCorrectLists
|
||||
[TestMethod]
|
||||
public void TestSatChannelsAddedToCorrectLists()
|
||||
{
|
||||
this.TestChannelsAddedToCorrectLists("GlobalClone00001.TLL", SignalSource.DvbS, 1138, 160, 8692, "DOWNLOAD G10 HUMAX");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region TestCableChannelsAddedToCorrectLists
|
||||
[TestMethod]
|
||||
public void TestCableChannelsAddedToCorrectLists()
|
||||
{
|
||||
this.TestChannelsAddedToCorrectLists("GlobalClone00002.TLL", SignalSource.DvbC, 405, 113, 11105, "ITV Content 01");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region TestAntennaChannelsAddedToCorrectLists
|
||||
[TestMethod]
|
||||
public void TestAntennaChannelsAddedToCorrectLists()
|
||||
{
|
||||
this.TestChannelsAddedToCorrectLists("GlobalClone00003.TLL", SignalSource.DvbT, 67, 6, 14120, "SRT8505 OTA");
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region TestChannelsAddedToCorrectList
|
||||
private void TestChannelsAddedToCorrectLists(string fileName, SignalSource signalSource, int expectedTv, int expectedRadio, int dataProgramSid, string dataProgramName)
|
||||
{
|
||||
var plugin = new GcSerializerPlugin();
|
||||
var ser = plugin.CreateSerializer(filesDir + fileName);
|
||||
ser.Load();
|
||||
|
||||
var root = ser.DataRoot;
|
||||
|
||||
var tv = root.GetChannelList(signalSource | SignalSource.Tv);
|
||||
Assert.IsNotNull(tv);
|
||||
Assert.AreEqual(expectedTv, tv.Channels.Count);
|
||||
|
||||
var radio = root.GetChannelList(signalSource | SignalSource.Radio);
|
||||
Assert.IsNotNull(radio);
|
||||
Assert.AreEqual(expectedRadio, radio.Channels.Count);
|
||||
|
||||
// check that data channel is in the TV list
|
||||
var chan = tv.Channels.FirstOrDefault(ch => ch.ServiceId == dataProgramSid);
|
||||
Assert.IsNotNull(chan);
|
||||
Assert.AreEqual(dataProgramName, chan.Name);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
20
source/Test.Loader.GlobalClone/Properties/AssemblyInfo.cs
Normal file
20
source/Test.Loader.GlobalClone/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("Test.Loader.GlobalClone")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Test.Loader.GlobalClone")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("aa31a65d-9437-42ae-89c8-98c7392b450d")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
102
source/Test.Loader.GlobalClone/Test.Loader.GlobalClone.csproj
Normal file
102
source/Test.Loader.GlobalClone/Test.Loader.GlobalClone.csproj
Normal file
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AA31A65D-9437-42AE-89C8-98C7392B450D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Test.Loader.GlobalClone</RootNamespace>
|
||||
<AssemblyName>Test.Loader.GlobalClone</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="LgGlobalCloneTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="TestFiles\GlobalClone00001.TLL">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="TestFiles\GlobalClone00002.TLL">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="TestFiles\GlobalClone00003.TLL">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj">
|
||||
<Project>{dccffa08-472b-4d17-bb90-8f513fc01392}</Project>
|
||||
<Name>ChanSort.Api</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ChanSort.Loader.GlobalClone\ChanSort.Loader.GlobalClone.csproj">
|
||||
<Project>{5361c8cb-f737-4709-af8c-e1f0456f3c5b}</Project>
|
||||
<Name>ChanSort.Loader.GlobalClone</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
||||
@@ -0,0 +1,2 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=testfiles/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
63604
source/Test.Loader.GlobalClone/TestFiles/GlobalClone00001.TLL
Normal file
63604
source/Test.Loader.GlobalClone/TestFiles/GlobalClone00001.TLL
Normal file
File diff suppressed because it is too large
Load Diff
75265
source/Test.Loader.GlobalClone/TestFiles/GlobalClone00002.TLL
Normal file
75265
source/Test.Loader.GlobalClone/TestFiles/GlobalClone00002.TLL
Normal file
File diff suppressed because it is too large
Load Diff
57465
source/Test.Loader.GlobalClone/TestFiles/GlobalClone00003.TLL
Normal file
57465
source/Test.Loader.GlobalClone/TestFiles/GlobalClone00003.TLL
Normal file
File diff suppressed because it is too large
Load Diff
5
source/Test.Loader.GlobalClone/packages.config
Normal file
5
source/Test.Loader.GlobalClone/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net48" />
|
||||
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net48" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user