@ -4,7 +4,9 @@ using FluentAssertions;
using Moq ;
using NUnit.Framework ;
using NzbDrone.Common.Disk ;
using NzbDrone.Common.EnvironmentInfo ;
using NzbDrone.Core.Test.Framework ;
using SixLabors.ImageSharp ;
namespace NzbDrone.Core.Test.MediaCoverTests
{
@ -14,13 +16,10 @@ namespace NzbDrone.Core.Test.MediaCoverTests
[SetUp]
public void SetUp ( )
{
Mocker . GetMock < IDiskProvider > ( )
. Setup ( v = > v . OpenReadStream ( It . IsAny < string > ( ) ) )
. Returns < string > ( s = > new FileStream ( s , FileMode . Open ) ) ;
Mocker . GetMock < IDiskProvider > ( )
. Setup ( v = > v . OpenWriteStream ( It . IsAny < string > ( ) ) )
. Returns < string > ( s = > new FileStream ( s , FileMode . Create ) ) ;
if ( PlatformInfo . IsMono & & PlatformInfo . GetVersion ( ) < new Version ( 5 , 8 ) )
{
Assert . Inconclusive ( "Not supported on Mono < 5.8" ) ;
}
Mocker . GetMock < IDiskProvider > ( )
. Setup ( v = > v . FileExists ( It . IsAny < string > ( ) ) )
@ -29,10 +28,8 @@ namespace NzbDrone.Core.Test.MediaCoverTests
Mocker . GetMock < IDiskProvider > ( )
. Setup ( v = > v . DeleteFile ( It . IsAny < string > ( ) ) )
. Callback < string > ( s = > File . Delete ( s ) ) ;
Mocker . GetMock < IDiskProvider > ( )
. Setup ( v = > v . CanUseGDIPlus ( ) )
. Returns ( true ) ;
Mocker . SetConstant < IPlatformInfo > ( Mocker . Resolve < PlatformInfo > ( ) ) ;
}
[Test]
@ -49,9 +46,11 @@ namespace NzbDrone.Core.Test.MediaCoverTests
fileInfo . Exists . Should ( ) . BeTrue ( ) ;
fileInfo . Length . Should ( ) . BeInRange ( 1000 , 30000 ) ;
var image = System . Drawing . Image . FromFile ( resizedFile ) ;
image . Height . Should ( ) . Be ( 170 ) ;
image . Width . Should ( ) . Be ( 170 ) ;
using ( var image = Image . Load ( resizedFile ) )
{
image . Height . Should ( ) . Be ( 170 ) ;
image . Width . Should ( ) . Be ( 170 ) ;
}
}
[Test]