@ -17,16 +17,16 @@ namespace NzbDrone.Core.Test.ProviderTests
// ReSharper disable InconsistentNaming
public class SceneMappingProviderTest : CoreTest
{
private const string SceneMappingUrl = "http:// www.nzbdrone.com/SceneMappings.csv ";
private const string SceneMappingUrl = "http:// services.nzbdrone.com/SceneMapping/Active ";
private void WithValid Csv ( )
private void WithValid Json ( )
{
Mocker . GetMock < HttpProvider > ( )
. Setup ( s = > s . DownloadString ( SceneMappingUrl ) )
. Returns ( File . ReadAllText ( @".\Files\SceneMappings. csv ") ) ;
. Returns ( File . ReadAllText ( @".\Files\SceneMappings. json ") ) ;
}
private void WithErrorDownloading Csv ( )
private void WithErrorDownloading Json ( )
{
Mocker . GetMock < HttpProvider > ( )
. Setup ( s = > s . DownloadString ( SceneMappingUrl ) )
@ -163,13 +163,13 @@ namespace NzbDrone.Core.Test.ProviderTests
{
//Setup
WithRealDb ( ) ;
WithValid Csv ( ) ;
WithValid Json ( ) ;
//Act
Mocker . Resolve < SceneMappingProvider > ( ) . UpdateMappings ( ) ;
//Assert
Mocker . Verify < HttpProvider > ( v = > v . DownloadString ( It. IsAny < string > ( ) ) , Times . Once ( ) ) ;
Mocker . Verify < HttpProvider > ( v = > v . DownloadString ( SceneMappingUrl ) , Times . Once ( ) ) ;
var result = Db . Fetch < SceneMapping > ( ) ;
result . Should ( ) . HaveCount ( 5 ) ;
}
@ -185,14 +185,14 @@ namespace NzbDrone.Core.Test.ProviderTests
. Build ( ) ;
WithRealDb ( ) ;
WithValid Csv ( ) ;
WithValid Json ( ) ;
Db . Insert ( fakeMap ) ;
//Act
Mocker . Resolve < SceneMappingProvider > ( ) . UpdateMappings ( ) ;
//Assert
Mocker . Verify < HttpProvider > ( v = > v . DownloadString ( It. IsAny < string > ( ) ) , Times . Once ( ) ) ;
Mocker . Verify < HttpProvider > ( v = > v . DownloadString ( SceneMappingUrl ) , Times . Once ( ) ) ;
var result = Db . Fetch < SceneMapping > ( ) ;
result . Should ( ) . HaveCount ( 5 ) ;
}
@ -208,14 +208,14 @@ namespace NzbDrone.Core.Test.ProviderTests
. Build ( ) ;
WithRealDb ( ) ;
WithErrorDownloading Csv ( ) ;
WithErrorDownloading Json ( ) ;
Db . Insert ( fakeMap ) ;
//Act
Mocker . Resolve < SceneMappingProvider > ( ) . UpdateMappings ( ) ;
//Assert
Mocker . Verify < HttpProvider > ( v = > v . DownloadString ( It. IsAny < string > ( ) ) , Times . Once ( ) ) ;
Mocker . Verify < HttpProvider > ( v = > v . DownloadString ( SceneMappingUrl ) , Times . Once ( ) ) ;
var result = Db . Fetch < SceneMapping > ( ) ;
result . Should ( ) . HaveCount ( 1 ) ;
}
@ -237,7 +237,7 @@ namespace NzbDrone.Core.Test.ProviderTests
Mocker . Resolve < SceneMappingProvider > ( ) . UpdateIfEmpty ( ) ;
//Assert
Mocker . Verify < HttpProvider > ( v = > v . DownloadString ( It. IsAny < string > ( ) ) , Times . Never ( ) ) ;
Mocker . Verify < HttpProvider > ( v = > v . DownloadString ( SceneMappingUrl ) , Times . Never ( ) ) ;
}
[Test]
@ -245,7 +245,7 @@ namespace NzbDrone.Core.Test.ProviderTests
{
//Setup
WithRealDb ( ) ;
WithValid Csv ( ) ;
WithValid Json ( ) ;
//Act
Mocker . Resolve < SceneMappingProvider > ( ) . UpdateIfEmpty ( ) ;