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

This commit is contained in:
Mark McDowall 2011-11-16 22:43:12 -08:00
commit ee494486ec
3 changed files with 19 additions and 23 deletions

View File

@ -9,12 +9,12 @@ namespace NzbDrone.Common.Test
public class WebClientTests : TestBase
{
[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().Contain("function(a,b)");
jquery.Should().Contain("Sitemap");
}
[TestCase("")]

View File

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

View File

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