You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Prowlarr/src/NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs

47 lines
1.4 KiB

using System.Collections.Generic;
12 years ago
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.Newznab;
using NzbDrone.Core.Indexers.Omgwtfnzbs;
using NzbDrone.Core.Indexers.Wombles;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.IndexerTests
{
public class IndexerServiceFixture : DbTest<IndexerFactory, IndexerDefinition>
{
private List<IIndexer> _indexers;
[SetUp]
public void Setup()
{
_indexers = new List<IIndexer>();
_indexers.Add(Mocker.GetMock<Newznab>().Object);
_indexers.Add(new Omgwtfnzbs());
_indexers.Add(new Wombles());
Mocker.SetConstant<IEnumerable<IIndexer>>(_indexers);
}
12 years ago
[Test]
public void should_remove_missing_indexers_on_startup()
{
var repo = Mocker.Resolve<IndexerRepository>();
Mocker.SetConstant<IIndexerRepository>(repo);
var existingIndexers = Builder<IndexerDefinition>.CreateNew().BuildNew();
existingIndexers.ConfigContract = typeof (NewznabSettings).Name;
12 years ago
repo.Insert(existingIndexers);
Subject.Handle(new ApplicationStartedEvent());
AllStoredModels.Should().NotContain(c => c.Id == existingIndexers.Id);
}
}
}