1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 15:32:31 +01:00

added test for mediainfo.dll

This commit is contained in:
kay.one 2013-09-12 22:55:33 -07:00
parent 0ebbe102c9
commit a81ca798a7
10 changed files with 48 additions and 6 deletions

Binary file not shown.

View File

@ -5,6 +5,7 @@ using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.MediaFiles.EpisodeImport.Specifications;
using NzbDrone.Core.MediaFiles.MediaInfo;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;

View File

@ -0,0 +1,22 @@
using System.IO;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.MediaFiles.MediaInfo;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.Categories;
namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
{
[TestFixture]
[DiskAccessTest]
public class VideoFileInfoReaderFixture : CoreTest<VideoFileInfoReader>
{
[Test]
public void get_runtime()
{
var path = Path.Combine(Directory.GetCurrentDirectory(), "Files", "Media", "H264_sample.mp4");
Subject.GetRunTime(path).Seconds.Should().Be(10);
}
}
}

View File

@ -141,6 +141,7 @@
<Compile Include="MediaFiles\EpisodeImport\Specifications\NotSampleSpecificationFixture.cs" />
<Compile Include="MediaFiles\EpisodeImport\Specifications\NotUnpackingSpecificationFixture.cs" />
<Compile Include="MediaFiles\EpisodeImport\Specifications\UpgradeSpecificationFixture.cs" />
<Compile Include="MediaFiles\MediaInfo\VideoFileInfoReaderFixture.cs" />
<Compile Include="MediaFiles\RenameEpisodeFileServiceFixture.cs" />
<Compile Include="MediaFiles\UpgradeMediaFileServiceFixture.cs" />
<Compile Include="MediaFiles\ImportApprovedEpisodesFixture.cs" />
@ -240,6 +241,9 @@
<Content Include="App_Data\Config.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Files\Media\H264_sample.mp4">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Files\Nzbget\JsonError.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

View File

@ -1,6 +1,7 @@
using System;
using System.IO;
using NLog;
using NzbDrone.Core.MediaFiles.MediaInfo;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Tv;

View File

@ -5,7 +5,7 @@ using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers
namespace NzbDrone.Core.MediaFiles.MediaInfo
{
public interface IVideoFileInfoReader
{
@ -31,7 +31,7 @@ namespace NzbDrone.Core.Providers
if (!_diskProvider.FileExists(filename))
throw new FileNotFoundException("Media file does not exist: " + filename);
var mediaInfo = new MediaInfo();
var mediaInfo = new MediaInfoLib.MediaInfo();
try
{
@ -112,10 +112,10 @@ namespace NzbDrone.Core.Providers
public TimeSpan GetRunTime(string filename)
{
MediaInfo mediaInfo = null;
MediaInfoLib.MediaInfo mediaInfo = null;
try
{
mediaInfo = new MediaInfo();
mediaInfo = new MediaInfoLib.MediaInfo();
_logger.Trace("Getting media info from {0}", filename);
mediaInfo.Option("ParseSpeed", "0.2");

View File

@ -228,6 +228,7 @@
<Compile Include="Instrumentation\Commands\TrimLogCommand.cs" />
<Compile Include="Instrumentation\DeleteLogFilesService.cs" />
<Compile Include="MediaFiles\MediaFileExtensions.cs" />
<Compile Include="MediaFiles\MediaInfo\VideoFileInfoReader.cs" />
<Compile Include="MetadataSource\Trakt\TraktException.cs" />
<Compile Include="NzbDroneClientException.cs" />
<Compile Include="Instrumentation\LoggerExtensions.cs" />
@ -416,7 +417,6 @@
<Compile Include="Model\Xem\XemValues.cs" />
<Compile Include="MediaCover\MediaCoverService.cs" />
<Compile Include="Download\Clients\Nzbget\NzbgetClient.cs" />
<Compile Include="Providers\VideoFileInfoReader.cs" />
<Compile Include="Download\Clients\PneumaticClient.cs" />
<Compile Include="MediaFiles\RecycleBinProvider.cs" />
<Compile Include="SeriesStats\SeriesStatistics.cs" />

View File

@ -0,0 +1,13 @@
using NUnit.Framework;
namespace NzbDrone.Test.Common.Categories
{
public class DiskAccessTestAttribute : CategoryAttribute
{
public DiskAccessTestAttribute()
: base("DiskAccessTest")
{
}
}
}

View File

@ -76,6 +76,7 @@
<Compile Include="AutoMoq\AutoMoqer.cs" />
<Compile Include="AutoMoq\Unity\AutoMockingBuilderStrategy.cs" />
<Compile Include="AutoMoq\Unity\AutoMockingContainerExtension.cs" />
<Compile Include="Categories\DiskAccessTestAttribute.cs" />
<Compile Include="ConcurrencyCounter.cs" />
<Compile Include="ExceptionVerification.cs" />
<Compile Include="Categories\IntegrationTestAttribute.cs" />

View File

@ -7,7 +7,7 @@
<FrameworkUtilisationTypeForGallio>Disabled</FrameworkUtilisationTypeForGallio>
<FrameworkUtilisationTypeForMSpec>Disabled</FrameworkUtilisationTypeForMSpec>
<FrameworkUtilisationTypeForMSTest>Disabled</FrameworkUtilisationTypeForMSTest>
<EngineModes>Run all tests automatically:BFRydWU=;Run all tests manually:BUZhbHNl;Run impacted tests automatically, others manually (experimental!):CklzSW1wYWN0ZWQ=;Run pinned tests automatically, others manually:CElzUGlubmVk;Fast:DlN0cnVjdHVyYWxOb2RlAwAAABNEb2VzTm90SGF2ZUNhdGVnb3J5D0ludGVncmF0aW9uVGVzdBNEb2VzTm90SGF2ZUNhdGVnb3J5BkRiVGVzdApJc0ltcGFjdGVkAAAAAAAAAAA=</EngineModes>
<EngineModes>Run all tests automatically:BFRydWU=;Run all tests manually:BUZhbHNl;Run impacted tests automatically, others manually (experimental!):CklzSW1wYWN0ZWQ=;Run pinned tests automatically, others manually:CElzUGlubmVk;Fast:DlN0cnVjdHVyYWxOb2RlBAAAABNEb2VzTm90SGF2ZUNhdGVnb3J5D0ludGVncmF0aW9uVGVzdBNEb2VzTm90SGF2ZUNhdGVnb3J5BkRiVGVzdApJc0ltcGFjdGVkE0RvZXNOb3RIYXZlQ2F0ZWdvcnkORGlza0FjY2Vzc1Rlc3QAAAAAAAAAAAAAAAA=</EngineModes>
<MetricsExclusionList>
</MetricsExclusionList>
</SolutionConfiguration>