diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-01-13 22:46:02 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-01-13 22:46:02 -0500 |
| commit | 1cb7a1b49cd3f088ed312eb97c6c01b317177104 (patch) | |
| tree | 3d67ae117f681cd188c9b65da268682ff6a82681 /MediaBrowser.Tests | |
| parent | e1da9c18a676c15fc8e4ded85fbf39831a26a62e (diff) | |
add m3u unit test
Diffstat (limited to 'MediaBrowser.Tests')
| -rw-r--r-- | MediaBrowser.Tests/M3uParserTest.cs | 44 | ||||
| -rw-r--r-- | MediaBrowser.Tests/MediaBrowser.Tests.csproj | 12 |
2 files changed, 56 insertions, 0 deletions
diff --git a/MediaBrowser.Tests/M3uParserTest.cs b/MediaBrowser.Tests/M3uParserTest.cs new file mode 100644 index 000000000..a6f4c3bd8 --- /dev/null +++ b/MediaBrowser.Tests/M3uParserTest.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Emby.Common.Implementations.Cryptography; +using Emby.Server.Implementations.LiveTv.TunerHosts; +using MediaBrowser.Common.Extensions; +using MediaBrowser.Model.Logging; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace MediaBrowser.Tests +{ + [TestClass] + public class M3uParserTest + { + [TestMethod] + public void TestFormat1() + { + BaseExtensions.CryptographyProvider = new CryptographyProvider(); + + var result = new M3uParser(new NullLogger(), null, null, null).ParseString("#EXTINF:0,84. VOX Schweiz\nhttp://mystream", "-", "-"); + Assert.AreEqual(1, result.Count); + + Assert.AreEqual("VOX Schweiz", result[0].Name); + Assert.AreEqual("84", result[0].Number); + } + [TestMethod] + public void TestFormat2() + { + BaseExtensions.CryptographyProvider = new CryptographyProvider(); + + var input = "#EXTINF:-1 tvg-id=\"\" tvg-name=\"ABC News 04\" tvg-logo=\"\" group-title=\"ABC Group\",ABC News 04"; + input += "\n"; + input += "http://mystream"; + + var result = new M3uParser(new NullLogger(), null, null, null).ParseString(input, "-", "-"); + Assert.AreEqual(1, result.Count); + + Assert.AreEqual("ABC News 04", result[0].Name); + Assert.IsNull(result[0].Number); + } + } +} diff --git a/MediaBrowser.Tests/MediaBrowser.Tests.csproj b/MediaBrowser.Tests/MediaBrowser.Tests.csproj index 4ea2cb0c0..8ba828d85 100644 --- a/MediaBrowser.Tests/MediaBrowser.Tests.csproj +++ b/MediaBrowser.Tests/MediaBrowser.Tests.csproj @@ -37,6 +37,9 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="Emby.Common.Implementations"> + <HintPath>..\ThirdParty\emby\Emby.Common.Implementations.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.XML" /> </ItemGroup> @@ -58,12 +61,21 @@ <Compile Include="ConsistencyTests\TextIndexing\WordIndex.cs" /> <Compile Include="ConsistencyTests\TextIndexing\WordOccurrence.cs" /> <Compile Include="ConsistencyTests\TextIndexing\WordOccurrences.cs" /> + <Compile Include="M3uParserTest.cs" /> <Compile Include="MediaEncoding\Subtitles\AssParserTests.cs" /> <Compile Include="MediaEncoding\Subtitles\SrtParserTests.cs" /> <Compile Include="MediaEncoding\Subtitles\VttWriterTest.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\Emby.Server.Implementations\Emby.Server.Implementations.csproj"> + <Project>{e383961b-9356-4d5d-8233-9a1079d03055}</Project> + <Name>Emby.Server.Implementations</Name> + </ProjectReference> + <ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj"> + <Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project> + <Name>MediaBrowser.Common</Name> + </ProjectReference> <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj"> <Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project> <Name>MediaBrowser.Controller</Name> |
