Merge branch 'kay.one' of github.com:NzbDrone/NzbDrone into markus

pull/2/head
Mark McDowall 13 years ago
commit ee494486ec

@ -9,12 +9,12 @@ namespace NzbDrone.Common.Test
public class WebClientTests : TestBase public class WebClientTests : TestBase
{ {
[Test] [Test]
public void DownloadString_should_be_able_to_download_jquery() public void DownloadString_should_be_able_to_dowload_text_file()
{ {
var jquery = new WebClientProvider().DownloadString("http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"); var jquery = new WebClientProvider().DownloadString("http://www.google.com/robots.txt");
jquery.Should().NotBeBlank(); jquery.Should().NotBeBlank();
jquery.Should().Contain("function(a,b)"); jquery.Should().Contain("Sitemap");
} }
[TestCase("")] [TestCase("")]

@ -21,18 +21,20 @@ namespace NzbDrone.Core.Test
readonly IList<Type> indexers = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(IndexerBase))).ToList(); readonly IList<Type> indexers = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(IndexerBase))).ToList();
readonly IList<Type> jobs = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IJob))).ToList(); readonly IList<Type> jobs = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IJob))).ToList();
private CentralDispatch centralDispatch; private IKernel kernel;
[SetUp] public CentralDispatchFixture()
public void Setup()
{ {
centralDispatch = new CentralDispatch(); InitLogging();
kernel = new CentralDispatch().Kernel;
WebTimer.Stop();
} }
[Test] [Test]
public void InitAppTest() public void InitAppTest()
{ {
centralDispatch.Kernel.Should().NotBeNull(); kernel.Should().NotBeNull();
} }
[Test] [Test]
@ -45,7 +47,7 @@ namespace NzbDrone.Core.Test
foreach (var provider in providers) foreach (var provider in providers)
{ {
Console.WriteLine("Resolving " + provider.Name); Console.WriteLine("Resolving " + provider.Name);
centralDispatch.Kernel.Get(provider).Should().NotBeNull(); kernel.Get(provider).Should().NotBeNull();
} }
} }
@ -55,7 +57,7 @@ namespace NzbDrone.Core.Test
{ {
//Assert //Assert
var registeredJobs = centralDispatch.Kernel.GetAll<IJob>(); var registeredJobs = kernel.GetAll<IJob>();
jobs.Should().NotBeEmpty(); jobs.Should().NotBeEmpty();
@ -68,7 +70,7 @@ namespace NzbDrone.Core.Test
{ {
//Assert //Assert
var registeredIndexers = centralDispatch.Kernel.GetAll<IndexerBase>(); var registeredIndexers = kernel.GetAll<IndexerBase>();
indexers.Should().NotBeEmpty(); indexers.Should().NotBeEmpty();
@ -79,35 +81,29 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void jobs_are_initialized() public void jobs_are_initialized()
{ {
centralDispatch.Kernel.Get<JobProvider>().All().Should().HaveSameCount(jobs); kernel.Get<JobProvider>().All().Should().HaveSameCount(jobs);
} }
[Test] [Test]
public void indexers_are_initialized() public void indexers_are_initialized()
{ {
centralDispatch.Kernel.Get<IndexerProvider>().All().Should().HaveSameCount(indexers); kernel.Get<IndexerProvider>().All().Should().HaveSameCount(indexers);
} }
[Test] [Test]
public void quality_profile_initialized() public void quality_profile_initialized()
{ {
centralDispatch.Kernel.Get<QualityProvider>().All().Should().HaveCount(2); kernel.Get<QualityProvider>().All().Should().HaveCount(2);
} }
[Test] [Test]
public void JobProvider_should_be_singletone() public void JobProvider_should_be_singletone()
{ {
var first = centralDispatch.Kernel.Get<JobProvider>(); var first = kernel.Get<JobProvider>();
var second = centralDispatch.Kernel.Get<JobProvider>(); var second = kernel.Get<JobProvider>();
first.Should().BeSameAs(second); first.Should().BeSameAs(second);
} }
[TearDown]
public void TearDownBase()
{
WebTimer.Stop();
}
} }
} }

@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
while (stopWatch.IsRunning) while (stopWatch.IsRunning)
{ {
Thread.Sleep(100); Thread.Sleep(10);
} }
} }

Loading…
Cancel
Save