1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

cleaned up CoreTest base class.

This commit is contained in:
kay.one 2013-01-19 15:55:58 -08:00
parent 77bb790672
commit 64a3e1caf0
12 changed files with 154 additions and 170 deletions

View File

@ -1,7 +1,7 @@
using System; using System;
using System.IO; using System.IO;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Core.Datastore;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
@ -11,30 +11,46 @@ namespace NzbDrone.Core.Test.Framework
{ {
public class CoreTest : TestBase public class CoreTest : TestBase
{ {
static CoreTest() private string _dbTemplateName;
[SetUp]
public void CoreTestSetup()
{ {
//Delete old db files _dbTemplateName = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()) + ".sdf";
var oldDbFiles = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.sdf", SearchOption.AllDirectories); CreateDataBaseTemplate();
foreach (var file in oldDbFiles)
{
try
{
File.Delete(file);
}
catch { }
} }
/* //Delete App_data folder private IDatabase GetEmptyDatabase(string fileName = "")
var appData = new EnvironmentProvider().GetAppDataPath();
if (Directory.Exists(appData))
{ {
//Directory.Delete(appData, true); Console.WriteLine("====================DataBase====================");
}*/ Console.WriteLine("Cloning database from template.");
TestDbHelper.CreateDataBaseTemplate(); if (String.IsNullOrWhiteSpace(fileName))
{
fileName = Guid.NewGuid() + ".sdf";
} }
File.Copy(_dbTemplateName, fileName);
var connectionString = ConnectionFactory.GetConnectionString(fileName);
var database = ConnectionFactory.GetPetaPocoDb(connectionString);
Console.WriteLine("====================DataBase====================");
Console.WriteLine();
Console.WriteLine();
return database;
}
private void CreateDataBaseTemplate()
{
Console.WriteLine("Creating an empty PetaPoco database");
var connectionString = ConnectionFactory.GetConnectionString(_dbTemplateName);
var database = ConnectionFactory.GetPetaPocoDb(connectionString);
database.Dispose();
}
private IDatabase _db; private IDatabase _db;
protected IDatabase Db protected IDatabase Db
@ -50,7 +66,7 @@ protected IDatabase Db
protected void WithRealDb() protected void WithRealDb()
{ {
_db = TestDbHelper.GetEmptyDatabase(); _db = GetEmptyDatabase();
Mocker.SetConstant(Db); Mocker.SetConstant(Db);
} }
@ -71,6 +87,18 @@ protected static void ThrowException()
public void CoreTestTearDown() public void CoreTestTearDown()
{ {
ConfigProvider.ClearCache(); ConfigProvider.ClearCache();
if (_db != null && _db.Connection != null && File.Exists(_db.Connection.Database))
{
var file = _db.Connection.Database;
_db.Dispose();
try
{
File.Delete(file);
}
catch (IOException) { }
}
} }
} }
} }

View File

@ -16,44 +16,6 @@ namespace NzbDrone.Core.Test.Framework
{ {
internal static class TestDbHelper internal static class TestDbHelper
{ {
private static readonly string dbTemplateName;
static TestDbHelper()
{
dbTemplateName = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()) + ".sdf";
}
internal static string ConnectionString { get; private set; }
internal static IDatabase GetEmptyDatabase(string fileName = "")
{
Console.WriteLine("====================DataBase====================");
Console.WriteLine("Cloning database from template.");
if (String.IsNullOrWhiteSpace(fileName))
{
fileName = Guid.NewGuid() + ".sdf";
}
File.Copy(dbTemplateName, fileName);
ConnectionString = ConnectionFactory.GetConnectionString(fileName);
var database = ConnectionFactory.GetPetaPocoDb(ConnectionString);
Console.WriteLine("====================DataBase====================");
Console.WriteLine();
Console.WriteLine();
return database;
}
internal static void CreateDataBaseTemplate()
{
Console.WriteLine("Creating an empty PetaPoco database");
var connectionString = ConnectionFactory.GetConnectionString(dbTemplateName);
var database = ConnectionFactory.GetPetaPocoDb(connectionString);
database.Dispose();
}
} }
} }

View File

@ -40,17 +40,16 @@ public void Delete_None_Valid_TvDbEpisodeId()
var db = TestDbHelper.GetEmptyDatabase(); WithRealDb();
Mocker.SetConstant(db);
db.Insert(fakeSeries); Db.Insert(fakeSeries);
db.Insert(fakeEpisode); Db.Insert(fakeEpisode);
//Act //Act
Mocker.Resolve<EpisodeProvider>().DeleteEpisodesNotInTvdb(fakeSeries, tvDbSeries); Mocker.Resolve<EpisodeProvider>().DeleteEpisodesNotInTvdb(fakeSeries, tvDbSeries);
//Assert //Assert
var result = db.Fetch<Episode>(); var result = Db.Fetch<Episode>();
result.Should().HaveCount(1); result.Should().HaveCount(1);
} }
@ -77,17 +76,16 @@ public void Delete_None_TvDbEpisodeId_is_zero()
var db = TestDbHelper.GetEmptyDatabase(); WithRealDb();
Mocker.SetConstant(db);
db.Insert(fakeSeries); Db.Insert(fakeSeries);
db.Insert(fakeEpisode); Db.Insert(fakeEpisode);
//Act //Act
Mocker.Resolve<EpisodeProvider>().DeleteEpisodesNotInTvdb(fakeSeries, tvDbSeries); Mocker.Resolve<EpisodeProvider>().DeleteEpisodesNotInTvdb(fakeSeries, tvDbSeries);
//Assert //Assert
var result = db.Fetch<Episode>(); var result = Db.Fetch<Episode>();
result.Should().HaveCount(1); result.Should().HaveCount(1);
} }
@ -112,19 +110,16 @@ public void Delete_None_TvDbEpisodeId_is_null()
.With(e => e.TvDbEpisodeId = null) .With(e => e.TvDbEpisodeId = null)
.Build(); .Build();
WithRealDb();
Db.Insert(fakeSeries);
var db = TestDbHelper.GetEmptyDatabase(); Db.Insert(fakeEpisode);
Mocker.SetConstant(db);
db.Insert(fakeSeries);
db.Insert(fakeEpisode);
//Act //Act
Mocker.Resolve<EpisodeProvider>().DeleteEpisodesNotInTvdb(fakeSeries, tvDbSeries); Mocker.Resolve<EpisodeProvider>().DeleteEpisodesNotInTvdb(fakeSeries, tvDbSeries);
//Assert //Assert
var result = db.Fetch<Episode>(); var result = Db.Fetch<Episode>();
result.Should().HaveCount(1); result.Should().HaveCount(1);
} }
@ -153,17 +148,16 @@ public void Delete_TvDbId()
var db = TestDbHelper.GetEmptyDatabase(); WithRealDb();
Mocker.SetConstant(db);
db.Insert(fakeSeries); Db.Insert(fakeSeries);
db.Insert(fakeEpisode); Db.Insert(fakeEpisode);
//Act //Act
Mocker.Resolve<EpisodeProvider>().DeleteEpisodesNotInTvdb(fakeSeries, tvDbSeries); Mocker.Resolve<EpisodeProvider>().DeleteEpisodesNotInTvdb(fakeSeries, tvDbSeries);
//Assert //Assert
var result = db.Fetch<Episode>(); var result = Db.Fetch<Episode>();
result.Should().HaveCount(0); result.Should().HaveCount(0);
} }
@ -205,19 +199,18 @@ public void Delete_TvDbId_multiple_series()
var db = TestDbHelper.GetEmptyDatabase(); WithRealDb();
Mocker.SetConstant(db);
db.Insert(fakeSeries); Db.Insert(fakeSeries);
db.Insert(fakeEpisode); Db.Insert(fakeEpisode);
db.Insert(otherFakeSeries); Db.Insert(otherFakeSeries);
db.Insert(otherFakeEpisode); Db.Insert(otherFakeEpisode);
//Act //Act
Mocker.Resolve<EpisodeProvider>().DeleteEpisodesNotInTvdb(fakeSeries, tvDbSeries); Mocker.Resolve<EpisodeProvider>().DeleteEpisodesNotInTvdb(fakeSeries, tvDbSeries);
//Assert //Assert
var result = db.Fetch<Episode>(); var result = Db.Fetch<Episode>();
result.Should().HaveCount(1); result.Should().HaveCount(1);
} }

View File

@ -24,9 +24,7 @@ public class IndexerProviderTest : CoreTest
[Test] [Test]
public void Init_indexer_test() public void Init_indexer_test()
{ {
WithRealDb();
Mocker.SetConstant(TestDbHelper.GetEmptyDatabase());
Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() }); Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() });
@ -46,7 +44,7 @@ public void Init_indexer_test()
[Test] [Test]
public void Init_indexer_with_disabled_job() public void Init_indexer_with_disabled_job()
{ {
Mocker.SetConstant(TestDbHelper.GetEmptyDatabase()); WithRealDb();
Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() }); Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() });
@ -65,7 +63,7 @@ public void Init_indexer_with_disabled_job()
[Test] [Test]
public void Init_indexer_should_enable_indexer_that_is_enabled_by_default() public void Init_indexer_should_enable_indexer_that_is_enabled_by_default()
{ {
Mocker.SetConstant(TestDbHelper.GetEmptyDatabase()); WithRealDb();
Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<DefaultEnabledIndexer>() }); Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<DefaultEnabledIndexer>() });
@ -82,7 +80,7 @@ public void Init_indexer_should_enable_indexer_that_is_enabled_by_default()
[Test] [Test]
public void Init_indexer_should_not_enable_indexer_that_is_not_enabled_by_default() public void Init_indexer_should_not_enable_indexer_that_is_not_enabled_by_default()
{ {
Mocker.SetConstant(TestDbHelper.GetEmptyDatabase()); WithRealDb();
Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() }); Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() });

View File

@ -37,13 +37,11 @@ public void get_series_files()
var database = TestDbHelper.GetEmptyDatabase(); WithRealDb();
database.InsertMany(firstSeriesFiles); Db.InsertMany(firstSeriesFiles);
database.InsertMany(secondSeriesFiles); Db.InsertMany(secondSeriesFiles);
Mocker.SetConstant(database);
var result = Mocker.Resolve<MediaFileProvider>().GetSeriesFiles(12); var result = Mocker.Resolve<MediaFileProvider>().GetSeriesFiles(12);
@ -69,13 +67,10 @@ public void get_season_files()
.Build(); .Build();
WithRealDb();
var database = TestDbHelper.GetEmptyDatabase(); Db.InsertMany(firstSeriesFiles);
Db.InsertMany(secondSeriesFiles);
database.InsertMany(firstSeriesFiles);
database.InsertMany(secondSeriesFiles);
Mocker.SetConstant(database);
var result = Mocker.Resolve<MediaFileProvider>().GetSeasonFiles(12, 1); var result = Mocker.Resolve<MediaFileProvider>().GetSeasonFiles(12, 1);
@ -157,13 +152,12 @@ public void DeleteEpisodeFile()
.Build(); .Build();
var database = TestDbHelper.GetEmptyDatabase(); WithRealDb();
Mocker.SetConstant(database); Db.InsertMany(episodeFiles);
database.InsertMany(episodeFiles);
//Act //Act
Mocker.Resolve<MediaFileProvider>().Delete(1); Mocker.Resolve<MediaFileProvider>().Delete(1);
var result = database.Fetch<EpisodeFile>(); var result = Db.Fetch<EpisodeFile>();
//Assert //Assert
result.Should().HaveCount(9); result.Should().HaveCount(9);

View File

@ -16,14 +16,15 @@ namespace NzbDrone.Core.Test.ProviderTests
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
public class QualityTypeProviderTest : CoreTest public class QualityTypeProviderTest : CoreTest
{ {
[SetUp]
public void SetuUp()
{
WithRealDb();
}
[Test] [Test]
public void SetupDefault_should_add_all_profiles() public void SetupDefault_should_add_all_profiles()
{ {
var db = TestDbHelper.GetEmptyDatabase();
Mocker.SetConstant(db);
Mocker.Resolve<QualityTypeProvider>(); Mocker.Resolve<QualityTypeProvider>();
@ -46,10 +47,7 @@ public void SetupDefault_should_add_all_profiles()
public void SetupDefault_already_exists_should_insert_missing() public void SetupDefault_already_exists_should_insert_missing()
{ {
var db = TestDbHelper.GetEmptyDatabase(); Db.Insert(new QualityType { QualityTypeId = 1, Name = "SDTV", MinSize = 0, MaxSize = 100 });
Mocker.SetConstant(db);
db.Insert(new QualityType { QualityTypeId = 1, Name = "SDTV", MinSize = 0, MaxSize = 100 });
Mocker.Resolve<QualityTypeProvider>(); Mocker.Resolve<QualityTypeProvider>();
@ -63,16 +61,12 @@ public void SetupDefault_already_exists_should_insert_missing()
[Test] [Test]
public void GetList_single_quality_type() public void GetList_single_quality_type()
{ {
var db = TestDbHelper.GetEmptyDatabase();
Mocker.SetConstant(db);
var fakeQualityTypes = Builder<QualityType>.CreateListOfSize(6) var fakeQualityTypes = Builder<QualityType>.CreateListOfSize(6)
.Build(); .Build();
var ids = new List<int> { 1 }; var ids = new List<int> { 1 };
db.InsertMany(fakeQualityTypes); Db.InsertMany(fakeQualityTypes);
var result = Mocker.Resolve<QualityTypeProvider>().GetList(ids); var result = Mocker.Resolve<QualityTypeProvider>().GetList(ids);
@ -84,16 +78,12 @@ public void GetList_single_quality_type()
[Test] [Test]
public void GetList_multiple_quality_type() public void GetList_multiple_quality_type()
{ {
var db = TestDbHelper.GetEmptyDatabase();
Mocker.SetConstant(db);
var fakeQualityTypes = Builder<QualityType>.CreateListOfSize(6) var fakeQualityTypes = Builder<QualityType>.CreateListOfSize(6)
.Build(); .Build();
var ids = new List<int> { 1, 2 }; var ids = new List<int> { 1, 2 };
db.InsertMany(fakeQualityTypes); Db.InsertMany(fakeQualityTypes);
var result = Mocker.Resolve<QualityTypeProvider>().GetList(ids); var result = Mocker.Resolve<QualityTypeProvider>().GetList(ids);

View File

@ -25,6 +25,8 @@ public void Setup()
{ {
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.ServiceRootUrl) Mocker.GetMock<ConfigProvider>().SetupGet(s => s.ServiceRootUrl)
.Returns("http://services.nzbdrone.com"); .Returns("http://services.nzbdrone.com");
WithRealDb();
} }
private void WithValidJson() private void WithValidJson()
@ -75,6 +77,7 @@ public void GetSeriesId_exists()
.With(f => f.SceneName = "laworder") .With(f => f.SceneName = "laworder")
.Build(); .Build();
Db.Insert(fakeMap); Db.Insert(fakeMap);
//Act //Act
@ -96,6 +99,7 @@ public void GetSceneName_null()
.With(f => f.SceneName = "laworder") .With(f => f.SceneName = "laworder")
.Build(); .Build();
Db.Insert(fakeMap); Db.Insert(fakeMap);
//Act //Act
@ -147,6 +151,8 @@ public void GetSceneName_multiple_clean_names()
.With(f => f.SeasonNumber = -1) .With(f => f.SeasonNumber = -1)
.Build(); .Build();
Db.Insert(fakeMap); Db.Insert(fakeMap);
Db.Insert(fakeMap2); Db.Insert(fakeMap2);
@ -177,8 +183,6 @@ public void GetSceneName_should_be_null_when_seasonNumber_does_not_match()
[Test] [Test]
public void UpdateMappings_should_add_all_mappings_to_database() public void UpdateMappings_should_add_all_mappings_to_database()
{ {
//Setup
WithRealDb();
WithValidJson(); WithValidJson();
//Act //Act
@ -200,7 +204,6 @@ public void UpdateMappings_should_overwrite_existing_mappings()
.With(f => f.SceneName = "laworder") .With(f => f.SceneName = "laworder")
.Build(); .Build();
WithRealDb();
WithValidJson(); WithValidJson();
Db.Insert(fakeMap); Db.Insert(fakeMap);
@ -223,7 +226,6 @@ public void UpdateMappings_should_not_delete_if_csv_download_fails()
.With(f => f.SceneName = "laworder") .With(f => f.SceneName = "laworder")
.Build(); .Build();
WithRealDb();
WithErrorDownloadingJson(); WithErrorDownloadingJson();
Db.Insert(fakeMap); Db.Insert(fakeMap);
@ -246,7 +248,6 @@ public void UpdateIfEmpty_should_not_update_if_count_is_not_zero()
.With(f => f.SceneName = "laworder") .With(f => f.SceneName = "laworder")
.Build(); .Build();
WithRealDb();
Db.Insert(fakeMap); Db.Insert(fakeMap);
//Act //Act
@ -260,7 +261,6 @@ public void UpdateIfEmpty_should_not_update_if_count_is_not_zero()
public void UpdateIfEmpty_should_update_if_count_is_zero() public void UpdateIfEmpty_should_update_if_count_is_zero()
{ {
//Setup //Setup
WithRealDb();
WithValidJson(); WithValidJson();
//Act //Act

View File

@ -17,11 +17,16 @@ namespace NzbDrone.Core.Test
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
public class QualityProfileTest : CoreTest<QualityProvider> public class QualityProfileTest : CoreTest<QualityProvider>
{ {
[SetUp]
public void SetUp()
{
WithRealDb();
}
[Test] [Test]
public void Test_Storage() public void Test_Storage()
{ {
//Arrange //Arrange
var database = TestDbHelper.GetEmptyDatabase();
var testProfile = new QualityProfile var testProfile = new QualityProfile
{ {
Name = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString(),
@ -30,8 +35,8 @@ public void Test_Storage()
}; };
var id = Convert.ToInt32(database.Insert(testProfile)); var id = Convert.ToInt32(Db.Insert(testProfile));
var fetch = database.SingleOrDefault<QualityProfile>(id); var fetch = Db.SingleOrDefault<QualityProfile>(id);
Assert.AreEqual(id, fetch.QualityProfileId); Assert.AreEqual(id, fetch.QualityProfileId);
@ -45,7 +50,6 @@ public void Test_Storage()
public void Test_Storage_no_allowed() public void Test_Storage_no_allowed()
{ {
//Arrange //Arrange
var database = TestDbHelper.GetEmptyDatabase();
var testProfile = new QualityProfile var testProfile = new QualityProfile
{ {
Name = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString(),
@ -53,8 +57,8 @@ public void Test_Storage_no_allowed()
}; };
var id = Convert.ToInt32(database.Insert(testProfile)); var id = Convert.ToInt32(Db.Insert(testProfile));
var fetch = database.SingleOrDefault<QualityProfile>(id); var fetch = Db.SingleOrDefault<QualityProfile>(id);
Assert.AreEqual(id, fetch.QualityProfileId); Assert.AreEqual(id, fetch.QualityProfileId);
@ -67,11 +71,6 @@ public void Test_Storage_no_allowed()
[Test] [Test]
public void Update_Success() public void Update_Success()
{ {
//Arrange
var db = TestDbHelper.GetEmptyDatabase();
Mocker.SetConstant(db);
var testProfile = new QualityProfile var testProfile = new QualityProfile
{ {
Name = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString(),
@ -79,8 +78,8 @@ public void Update_Success()
}; };
var id = Convert.ToInt32(db.Insert(testProfile)); var id = Convert.ToInt32(Db.Insert(testProfile));
var currentProfile = db.SingleOrDefault<QualityProfile>(id); var currentProfile = Db.SingleOrDefault<QualityProfile>(id);
//Update //Update
@ -99,9 +98,6 @@ public void Update_Success()
[Test] [Test]
public void Test_Series_Quality() public void Test_Series_Quality()
{ {
//Arrange
var database = TestDbHelper.GetEmptyDatabase();
var testProfile = new QualityProfile var testProfile = new QualityProfile
{ {
Name = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString(),
@ -110,18 +106,18 @@ public void Test_Series_Quality()
}; };
var profileId = Convert.ToInt32(database.Insert(testProfile)); var profileId = Convert.ToInt32(Db.Insert(testProfile));
var series = Builder<Series>.CreateNew().Build(); var series = Builder<Series>.CreateNew().Build();
series.QualityProfileId = profileId; series.QualityProfileId = profileId;
database.Insert(testProfile); Db.Insert(testProfile);
database.Insert(series); Db.Insert(series);
var result = database.Fetch<Series>(); var result = Db.Fetch<Series>();
result.Should().HaveCount(1); result.Should().HaveCount(1);
var profile = database.SingleOrDefault<QualityProfile>(result[0].QualityProfileId); var profile = Db.SingleOrDefault<QualityProfile>(result[0].QualityProfileId);
Assert.AreEqual(profileId, result[0].QualityProfileId); Assert.AreEqual(profileId, result[0].QualityProfileId);
Assert.AreEqual(testProfile.Name, profile.Name); Assert.AreEqual(testProfile.Name, profile.Name);
} }
@ -131,10 +127,6 @@ public void Test_Series_Quality()
public void SetupInitial_should_add_two_profiles() public void SetupInitial_should_add_two_profiles()
{ {
var db = TestDbHelper.GetEmptyDatabase();
Mocker.SetConstant(db);
Mocker.Resolve<QualityProvider>(); Mocker.Resolve<QualityProvider>();
@ -152,8 +144,6 @@ public void SetupInitial_should_add_two_profiles()
//We don't want to keep adding them back if a user deleted them on purpose. //We don't want to keep adding them back if a user deleted them on purpose.
public void SetupInitial_should_skip_if_any_profile_exists() public void SetupInitial_should_skip_if_any_profile_exists()
{ {
WithRealDb();
InitiateSubject(); InitiateSubject();
var profiles = Subject.All(); var profiles = Subject.All();

View File

@ -32,7 +32,8 @@ public class DbBenchmark : CoreTest
[TestFixtureSetUp] [TestFixtureSetUp]
public void Setup() public void Setup()
{ {
db = TestDbHelper.GetEmptyDatabase(); WithRealDb();
int currentFileId = 0; int currentFileId = 0;
@ -42,7 +43,7 @@ public void Setup()
Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.Bluray1080p }, Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.Bluray1080p },
Cutoff = QualityTypes.DVD Cutoff = QualityTypes.DVD
}; };
db.Insert(qulityProfile); Db.Insert(qulityProfile);
foreach (var _seriesId in seriesIds) foreach (var _seriesId in seriesIds)
{ {
@ -52,7 +53,7 @@ public void Setup()
.With(s => s.Monitored = true) .With(s => s.Monitored = true)
.Build(); .Build();
db.Insert(series); Db.Insert(series);
foreach (var _seasonNumber in seasonsNumbers) foreach (var _seasonNumber in seasonsNumbers)
{ {
@ -94,8 +95,8 @@ public void Setup()
} }
db.InsertMany(episodes); Db.InsertMany(episodes);
db.InsertMany(files); Db.InsertMany(files);
} }

View File

@ -100,6 +100,13 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MiniProfiler.2.0.2\lib\net40\MiniProfiler.dll</HintPath> <HintPath>..\packages\MiniProfiler.2.0.2\lib\net40\MiniProfiler.dll</HintPath>
</Reference> </Reference>
<Reference Include="Nancy, Version=0.15.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Nancy.0.15.3\lib\net40\Nancy.dll</HintPath>
</Reference>
<Reference Include="Nancy.Hosting.Aspnet">
<HintPath>..\packages\Nancy.Hosting.Aspnet.0.15.3\lib\net40\Nancy.Hosting.Aspnet.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>

View File

@ -41,6 +41,7 @@
<remove name="UrlRoutingHandler" /> <remove name="UrlRoutingHandler" />
<add name="MvcHttpHandler" preCondition="integratedMode" verb="" path=".mvc" type="System.Web.Mvc.MvcHttpHandler" /> <add name="MvcHttpHandler" preCondition="integratedMode" verb="" path=".mvc" type="System.Web.Mvc.MvcHttpHandler" />
<add name="CassetteHttpHandler" path="cassette.axd" preCondition="integratedMode" verb="*" allowPathInfo="true" type="Cassette.Aspnet.CassetteHttpHandler, Cassette.Aspnet" /> <add name="CassetteHttpHandler" path="cassette.axd" preCondition="integratedMode" verb="*" allowPathInfo="true" type="Cassette.Aspnet.CassetteHttpHandler, Cassette.Aspnet" />
<add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</handlers> </handlers>
<directoryBrowse enabled="false" /> <directoryBrowse enabled="false" />
<staticContent> <staticContent>
@ -81,4 +82,22 @@
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /> <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories> </DbProviderFactories>
</system.data> </system.data>
<location path="api" allowOverride="false">
<system.web>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
<add name="Pragma" value="no-cache" />
<add name="Expires" value="0" />
</customHeaders>
</httpProtocol>
<handlers>
<add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</handlers>
<httpErrors errorMode="Detailed" />
</system.webServer>
</location>
</configuration> </configuration>

View File

@ -26,6 +26,8 @@
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" /> <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
<package id="MiniProfiler" version="2.0.2" /> <package id="MiniProfiler" version="2.0.2" />
<package id="MiniProfiler.MVC3" version="2.0.2" /> <package id="MiniProfiler.MVC3" version="2.0.2" />
<package id="Nancy" version="0.15.3" targetFramework="net40" />
<package id="Nancy.Hosting.Aspnet" version="0.15.3" targetFramework="net40" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" /> <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
<package id="NLog" version="2.0.0.2000" /> <package id="NLog" version="2.0.0.2000" />
<package id="ServiceStack.Text" version="3.9.27" targetFramework="net40" /> <package id="ServiceStack.Text" version="3.9.27" targetFramework="net40" />