mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-18 21:35:51 -04:00
moved config to objectdb.
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using PetaPoco;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.ConfigProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ConfigCachingFixture : CoreTest
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<IDatabase>().Setup(c => c.Fetch<Config>())
|
||||
.Returns(new List<Config> { new Config { Key = "Key1", Value = "Value1" } });
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void getting_value_more_than_once_should_hit_db_once()
|
||||
{
|
||||
Mocker.Resolve<ConfigProvider>().GetValue("Key1", null).Should().Be("Value1");
|
||||
Mocker.Resolve<ConfigProvider>().GetValue("Key1", null).Should().Be("Value1");
|
||||
Mocker.Resolve<ConfigProvider>().GetValue("Key1", null).Should().Be("Value1");
|
||||
|
||||
Mocker.GetMock<IDatabase>().Verify(c => c.Fetch<Config>(), Times.Once());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.ConfigProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class ConfigProviderFixture : SqlCeTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
WithRealDb();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Add_new_value_to_database()
|
||||
{
|
||||
const string key = "MY_KEY";
|
||||
const string value = "MY_VALUE";
|
||||
|
||||
Mocker.Resolve<ConfigProvider>().SetValue(key, value);
|
||||
Mocker.Resolve<ConfigProvider>().GetValue(key, "").Should().Be(value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_value_from_database()
|
||||
{
|
||||
const string key = "MY_KEY";
|
||||
const string value = "MY_VALUE";
|
||||
|
||||
|
||||
Db.Insert(new Config { Key = key, Value = value });
|
||||
Db.Insert(new Config { Key = "Other Key", Value = "OtherValue" });
|
||||
|
||||
//Act
|
||||
var result = Mocker.Resolve<ConfigProvider>().GetValue(key, "");
|
||||
|
||||
//Assert
|
||||
result.Should().Be(value);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void Get_value_should_return_default_when_no_value()
|
||||
{
|
||||
const string key = "MY_KEY";
|
||||
const string value = "MY_VALUE";
|
||||
|
||||
//Act
|
||||
var result = Mocker.Resolve<ConfigProvider>().GetValue(key, value);
|
||||
|
||||
//Assert
|
||||
result.Should().Be(value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void New_value_should_update_old_value_new_value()
|
||||
{
|
||||
const string key = "MY_KEY";
|
||||
const string originalValue = "OLD_VALUE";
|
||||
const string newValue = "NEW_VALUE";
|
||||
|
||||
Db.Insert(new Config { Key = key, Value = originalValue });
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<ConfigProvider>().SetValue(key, newValue);
|
||||
var result = Mocker.Resolve<ConfigProvider>().GetValue(key, "");
|
||||
|
||||
//Assert
|
||||
result.Should().Be(newValue);
|
||||
Db.Fetch<Config>().Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void New_value_should_update_old_value_same_value()
|
||||
{
|
||||
const string key = "MY_KEY";
|
||||
const string value = "OLD_VALUE";
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<ConfigProvider>().SetValue(key, value);
|
||||
Mocker.Resolve<ConfigProvider>().SetValue(key, value);
|
||||
var result = Mocker.Resolve<ConfigProvider>().GetValue(key, "");
|
||||
|
||||
//Assert
|
||||
result.Should().Be(value);
|
||||
Db.Fetch<Config>().Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void get_value_with_persist_should_store_default_value()
|
||||
{
|
||||
const string key = "MY_KEY";
|
||||
string value = Guid.NewGuid().ToString();
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<ConfigProvider>().GetValue(key, value, persist: true).Should().Be(value);
|
||||
Mocker.Resolve<ConfigProvider>().GetValue(key, string.Empty).Should().Be(value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void get_value_with_out_persist_should_not_store_default_value()
|
||||
{
|
||||
const string key = "MY_KEY";
|
||||
string value1 = Guid.NewGuid().ToString();
|
||||
string value2 = Guid.NewGuid().ToString();
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<ConfigProvider>().GetValue(key, value1).Should().Be(value1);
|
||||
Mocker.Resolve<ConfigProvider>().GetValue(key, value2).Should().Be(value2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Test]
|
||||
public void uguid_should_only_be_set_once()
|
||||
{
|
||||
var guid1 = Mocker.Resolve<ConfigProvider>().UGuid;
|
||||
var guid2 = Mocker.Resolve<ConfigProvider>().UGuid;
|
||||
|
||||
guid1.Should().Be(guid2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void uguid_should_return_valid_result_on_first_call()
|
||||
{
|
||||
var guid = Mocker.Resolve<ConfigProvider>().UGuid;
|
||||
guid.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void updating_a_vakye_should_update_its_value()
|
||||
{
|
||||
Mocker.Resolve<ConfigProvider>().SabHost = "Test";
|
||||
Mocker.Resolve<ConfigProvider>().SabHost.Should().Be("Test");
|
||||
|
||||
Mocker.Resolve<ConfigProvider>().SabHost = "Test2";
|
||||
Mocker.Resolve<ConfigProvider>().SabHost.Should().Be("Test2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Description("This test will use reflection to ensure each config property read/writes to a unique key")]
|
||||
public void config_properties_should_write_and_read_using_same_key()
|
||||
{
|
||||
var configProvider = Mocker.Resolve<ConfigProvider>();
|
||||
var allProperties = typeof(ConfigProvider).GetProperties().Where(p => p.GetSetMethod() != null);
|
||||
|
||||
|
||||
//Act
|
||||
foreach (var propertyInfo in allProperties)
|
||||
{
|
||||
object value = null;
|
||||
|
||||
if (propertyInfo.PropertyType == typeof(string))
|
||||
{
|
||||
value = new Guid().ToString();
|
||||
}
|
||||
else if (propertyInfo.PropertyType == typeof(int))
|
||||
{
|
||||
value = DateTime.Now.Millisecond;
|
||||
}
|
||||
else if (propertyInfo.PropertyType == typeof(bool))
|
||||
{
|
||||
value = true;
|
||||
}
|
||||
else if (propertyInfo.PropertyType.BaseType == typeof(Enum))
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
|
||||
propertyInfo.GetSetMethod().Invoke(configProvider, new[] { value });
|
||||
var returnValue = propertyInfo.GetGetMethod().Invoke(configProvider, null);
|
||||
|
||||
if (propertyInfo.PropertyType.BaseType == typeof(Enum))
|
||||
{
|
||||
returnValue = (int)returnValue;
|
||||
}
|
||||
|
||||
returnValue.Should().Be(value, propertyInfo.Name);
|
||||
}
|
||||
|
||||
Db.Fetch<Config>().Should()
|
||||
.HaveSameCount(allProperties, "two different properties are writing to the same key in db. Copy/Past fail.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
@@ -90,7 +91,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(e => e.Delete(It.IsAny<int>()));
|
||||
|
||||
Mocker.GetMock<ConfigProvider>()
|
||||
Mocker.GetMock<ConfigService>()
|
||||
.SetupGet(s => s.AutoIgnorePreviouslyDownloadedEpisodes)
|
||||
.Returns(true);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Providers.DownloadClients;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
@@ -26,7 +27,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.BlackholeDirectory).Returns(blackHoleFolder);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(c => c.BlackholeDirectory).Returns(blackHoleFolder);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Model.Nzbget;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Providers.DownloadClients;
|
||||
@@ -19,7 +20,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTes
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
||||
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||
fakeConfig.SetupGet(c => c.NzbgetHost).Returns("192.168.5.55");
|
||||
fakeConfig.SetupGet(c => c.NzbgetPort).Returns(6789);
|
||||
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Model.Nzbget;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Providers.DownloadClients;
|
||||
@@ -19,7 +20,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTes
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
||||
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||
fakeConfig.SetupGet(c => c.NzbgetHost).Returns("192.168.5.55");
|
||||
fakeConfig.SetupGet(c => c.NzbgetPort).Returns(6789);
|
||||
fakeConfig.SetupGet(c => c.NzbgetUsername).Returns("nzbget");
|
||||
|
||||
@@ -8,6 +8,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Providers.DownloadClients;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
@@ -29,8 +30,8 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
||||
{
|
||||
nzbPath = pneumaticFolder + title + ".nzb";
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.PneumaticDirectory).Returns(pneumaticFolder);
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.DownloadClientTvDirectory).Returns(sabDrop);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(c => c.PneumaticDirectory).Returns(pneumaticFolder);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(c => c.DownloadClientTvDirectory).Returns(sabDrop);
|
||||
}
|
||||
|
||||
private void WithExistingFile()
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Sabnzbd;
|
||||
@@ -35,7 +36,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||
string password = "pass";
|
||||
string cat = "tv";
|
||||
|
||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
||||
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||
fakeConfig.SetupGet(c => c.SabHost).Returns(sabHost);
|
||||
fakeConfig.SetupGet(c => c.SabPort).Returns(sabPort);
|
||||
fakeConfig.SetupGet(c => c.SabApiKey).Returns(apikey);
|
||||
|
||||
+6
-5
@@ -10,6 +10,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Sabnzbd;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@@ -31,7 +32,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
||||
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||
|
||||
fakeConfig.SetupGet(c => c.SabHost).Returns("192.168.5.55");
|
||||
fakeConfig.SetupGet(c => c.SabPort).Returns(2222);
|
||||
@@ -209,11 +210,11 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||
[Test]
|
||||
public void downloadNzb_should_use_sabRecentTvPriority_when_recentEpisode_is_true()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>()
|
||||
Mocker.GetMock<ConfigService>()
|
||||
.SetupGet(s => s.SabRecentTvPriority)
|
||||
.Returns(SabPriorityType.High);
|
||||
|
||||
Mocker.GetMock<ConfigProvider>()
|
||||
Mocker.GetMock<ConfigService>()
|
||||
.SetupGet(s => s.SabBacklogTvPriority)
|
||||
.Returns(SabPriorityType.Low);
|
||||
|
||||
@@ -231,11 +232,11 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||
[Test]
|
||||
public void downloadNzb_should_use_sabBackogTvPriority_when_recentEpisode_is_false()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>()
|
||||
Mocker.GetMock<ConfigService>()
|
||||
.SetupGet(s => s.SabRecentTvPriority)
|
||||
.Returns(SabPriorityType.High);
|
||||
|
||||
Mocker.GetMock<ConfigProvider>()
|
||||
Mocker.GetMock<ConfigService>()
|
||||
.SetupGet(s => s.SabBacklogTvPriority)
|
||||
.Returns(SabPriorityType.Low);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
@@ -33,7 +34,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
|
||||
|
||||
private void SetDownloadClient(DownloadClientType clientType)
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>()
|
||||
Mocker.GetMock<ConfigService>()
|
||||
.Setup(c => c.DownloadClient)
|
||||
.Returns(clientType);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
@@ -133,7 +134,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.Build();
|
||||
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().Setup(e => e.SortingSeasonFolderFormat).Returns(seasonFolderFormat);
|
||||
Mocker.GetMock<ConfigService>().Setup(e => e.SortingSeasonFolderFormat).Returns(seasonFolderFormat);
|
||||
|
||||
//Act
|
||||
var result = Mocker.Resolve<MediaFileProvider>().CalculateFilePath(fakeSeries, 1, filename, ".mkv");
|
||||
|
||||
@@ -8,6 +8,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@@ -93,7 +94,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
|
||||
|
||||
private void WithUseBanners()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.MetadataUseBanners).Returns(true);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.MetadataUseBanners).Returns(true);
|
||||
}
|
||||
|
||||
private void WithSingleEpisodeFile()
|
||||
|
||||
@@ -7,6 +7,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@@ -75,7 +76,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
|
||||
|
||||
private void WithUseBanners()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.MetadataUseBanners).Returns(true);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.MetadataUseBanners).Returns(true);
|
||||
}
|
||||
|
||||
private void WithSpecials()
|
||||
|
||||
@@ -10,6 +10,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Model.Xbmc;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@@ -26,22 +27,22 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
{
|
||||
private void WithSingleClient()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.PlexClientHosts)
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexClientHosts)
|
||||
.Returns("localhost:3000");
|
||||
}
|
||||
|
||||
private void WithMultipleClients()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.PlexClientHosts)
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexClientHosts)
|
||||
.Returns("localhost:3000, 192.168.0.10:3000");
|
||||
}
|
||||
|
||||
public void WithClientCredentials()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.PlexUsername)
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexUsername)
|
||||
.Returns("plex");
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.PlexPassword)
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.PlexPassword)
|
||||
.Returns("plex");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@@ -49,7 +50,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectories(RecycleBin))
|
||||
.Returns(new [] { @"C:\Test\RecycleBin\Folder1", @"C:\Test\RecycleBin\Folder2", @"C:\Test\RecycleBin\Folder3" });
|
||||
@@ -61,7 +62,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
[Test]
|
||||
public void should_return_if_recycleBin_not_configured()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||
|
||||
Mocker.Resolve<RecycleBinProvider>().Cleanup();
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@@ -28,12 +29,12 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
{
|
||||
private void WithRecycleBin()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
|
||||
}
|
||||
|
||||
private void WithoutRecycleBin()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -10,6 +10,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@@ -28,12 +29,12 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
{
|
||||
private void WithRecycleBin()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
|
||||
}
|
||||
|
||||
private void WithoutRecycleBin()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -10,6 +10,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@@ -31,7 +32,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(RecycleBin);
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectories(RecycleBin))
|
||||
.Returns(new [] { @"C:\Test\RecycleBin\Folder1", @"C:\Test\RecycleBin\Folder2", @"C:\Test\RecycleBin\Folder3" });
|
||||
@@ -43,7 +44,7 @@ namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
[Test]
|
||||
public void should_return_if_recycleBin_not_configured()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.RecycleBin).Returns(String.Empty);
|
||||
|
||||
Mocker.Resolve<RecycleBinProvider>().Empty();
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.ServiceRootUrl)
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.ServiceRootUrl)
|
||||
.Returns("http://services.nzbdrone.com");
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
@@ -23,7 +24,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.ServiceRootUrl)
|
||||
Mocker.GetMock<ConfigService>().SetupGet(s => s.ServiceRootUrl)
|
||||
.Returns("http://services.nzbdrone.com");
|
||||
|
||||
WithRealDb();
|
||||
|
||||
@@ -4,6 +4,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
@@ -22,7 +23,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
|
||||
{
|
||||
WithStrictMocker();
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/_test/");
|
||||
Mocker.GetMock<ConfigService>().SetupGet(c => c.UpdateUrl).Returns("http://update.nzbdrone.com/_test/");
|
||||
Mocker.Resolve<HttpProvider>();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model.Xbmc;
|
||||
using NzbDrone.Core.Providers;
|
||||
@@ -296,7 +297,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
var header = "NzbDrone Test";
|
||||
var message = "Test Message!";
|
||||
|
||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
||||
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||
fakeConfig.SetupGet(s => s.XbmcHosts).Returns("localhost:8080");
|
||||
|
||||
//var fakeUdpProvider = Mocker.GetMock<EventClient>();
|
||||
@@ -440,7 +441,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
//Setup
|
||||
WithStrictMocker();
|
||||
|
||||
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
||||
var fakeConfig = Mocker.GetMock<ConfigService>();
|
||||
fakeConfig.SetupGet(s => s.XbmcHosts).Returns("localhost:8080");
|
||||
|
||||
var fakeEventClient = Mocker.GetMock<EventClientProvider>();
|
||||
|
||||
Reference in New Issue
Block a user