diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 39bda7be4..8a79c19af 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -182,6 +182,7 @@ + diff --git a/NzbDrone.Core.Test/ThingiProviderTests/NullConfigFixture.cs b/NzbDrone.Core.Test/ThingiProviderTests/NullConfigFixture.cs new file mode 100644 index 000000000..0f47d9a91 --- /dev/null +++ b/NzbDrone.Core.Test/ThingiProviderTests/NullConfigFixture.cs @@ -0,0 +1,17 @@ +using FluentAssertions; +using NUnit.Framework; +using NzbDrone.Core.Test.Framework; +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Test.ThingiProviderTests +{ + [TestFixture] + public class NullConfigFixture : CoreTest + { + [Test] + public void should_be_valid() + { + Subject.Validate().IsValid.Should().BeTrue(); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Indexers/IndexerBase.cs b/NzbDrone.Core/Indexers/IndexerBase.cs index ddedc098c..41942d35b 100644 --- a/NzbDrone.Core/Indexers/IndexerBase.cs +++ b/NzbDrone.Core/Indexers/IndexerBase.cs @@ -4,7 +4,7 @@ using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers { - public abstract class IndexerBase : IIndexer + public abstract class IndexerBase : IIndexer where TSettings : IProviderConfig, new() { public Type ConfigContract { @@ -18,12 +18,14 @@ namespace NzbDrone.Core.Indexers { get { + var config = (IProviderConfig)new TSettings(); + yield return new IndexerDefinition { - Name = this.GetType().Name, - Enable = false, + Name = GetType().Name, + Enable = config.Validate().IsValid, Implementation = GetType().Name, - Settings = NullConfig.Instance + Settings = config }; } } diff --git a/NzbDrone.Integration.Test/IndexerIntegrationFixture.cs b/NzbDrone.Integration.Test/IndexerIntegrationFixture.cs index 33fb6e0ab..96003762b 100644 --- a/NzbDrone.Integration.Test/IndexerIntegrationFixture.cs +++ b/NzbDrone.Integration.Test/IndexerIntegrationFixture.cs @@ -1,5 +1,7 @@ -using FluentAssertions; +using System.Linq; +using FluentAssertions; using NUnit.Framework; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Integration.Test { @@ -13,6 +15,7 @@ namespace NzbDrone.Integration.Test indexers.Should().NotBeEmpty(); indexers.Should().NotContain(c => string.IsNullOrWhiteSpace(c.Name)); + indexers.Where(c => c.ConfigContract == typeof(NullConfig).Name).Should().OnlyContain(c => c.Enable); } } } \ No newline at end of file diff --git a/NzbDrone.Integration.Test/ReleaseIntegrationTest.cs b/NzbDrone.Integration.Test/ReleaseIntegrationTest.cs index b9a86674e..eb76f1255 100644 --- a/NzbDrone.Integration.Test/ReleaseIntegrationTest.cs +++ b/NzbDrone.Integration.Test/ReleaseIntegrationTest.cs @@ -1,4 +1,5 @@ -using FluentAssertions; +using System.Threading; +using FluentAssertions; using NUnit.Framework; using NzbDrone.Api.Indexers; @@ -10,10 +11,13 @@ namespace NzbDrone.Integration.Test [Test] public void should_only_have_unknown_series_releases() { + var releases = Releases.All(); + var indexers = Indexers.All(); + releases.Should().OnlyContain(c => c.Rejections.Contains("Unknown Series")); - releases.Should().OnlyContain(c=>BeValidRelease(c)); + releases.Should().OnlyContain(c => BeValidRelease(c)); }