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