updated history table

This commit is contained in:
kay.one
2013-06-08 23:20:38 -07:00
parent 8467349305
commit ca71025bca
13 changed files with 139 additions and 57 deletions
@@ -3,8 +3,6 @@ using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.History;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HistoryTests
@@ -30,5 +28,18 @@ namespace NzbDrone.Core.Test.HistoryTests
AllStoredModels.Should().HaveCount(10);
AllStoredModels.Should().OnlyContain(s => s.Date > DateTime.Now.AddDays(-30));
}
[Test]
public void should_read_write_dictionary()
{
var history = Builder<History.History>.CreateNew().BuildNew();
history.Data.Add("key1","value1");
history.Data.Add("key2","value2");
Subject.Insert(history);
StoredModel.Data.Should().HaveCount(2);
}
}
}
@@ -34,28 +34,6 @@ namespace NzbDrone.Core.Test.MediaFileTests
}
[Test]
public void get_files_by_season()
{
var files = Builder<EpisodeFile>.CreateListOfSize(20)
.All()
.With(c => c.Id = 0)
.With(s => s.SeasonNumber = 10)
.TheFirst(10)
.With(c => c.SeriesId = 1)
.TheNext(10)
.With(c => c.SeriesId = 2)
.Random(10)
.With(s => s.SeasonNumber = 20)
.Build();
Db.InsertMany(files);
Subject.GetFilesBySeason(1, 20).Should().OnlyContain(c => c.SeriesId == 1 && c.SeasonNumber == 20);
}
[Test]
public void GetFileByPath_should_return_null_if_file_does_not_exist_in_database()
@@ -58,7 +58,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
[Test]
public void should_import_file()
{
Subject.ProcessDownloadedEpiosdesFolder();
Subject.ProcessDownloadedEpisodesFolder();
VerifyImport();
}
@@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
{
WithRecentFolderWrite();
Subject.ProcessDownloadedEpiosdesFolder();
Subject.ProcessDownloadedEpisodesFolder();
VerifyNoImport();
}
@@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
{
WithOldWrite();
Subject.ProcessDownloadedEpiosdesFolder();
Subject.ProcessDownloadedEpisodesFolder();
Mocker.GetMock<IParsingService>().Verify(c => c.GetSeries("foldername"), Times.Once());
@@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
Mocker.GetMock<IDiskScanService>().Setup(c => c.ImportFile(It.IsAny<Series>(), It.IsAny<string>()))
.Returns(_fakeEpisodeFile);
Subject.ProcessDownloadedEpiosdesFolder();
Subject.ProcessDownloadedEpisodesFolder();
Mocker.GetMock<IMoveEpisodeFiles>().Verify(c => c.MoveEpisodeFile(_fakeEpisodeFile, true), Times.Once());
}
@@ -101,7 +101,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
Mocker.GetMock<IDiskScanService>().Setup(c => c.ImportFile(It.IsAny<Series>(), It.IsAny<string>()))
.Returns<EpisodeFile>(null);
Subject.ProcessDownloadedEpiosdesFolder();
Subject.ProcessDownloadedEpisodesFolder();
Mocker.GetMock<IMoveEpisodeFiles>().Verify(c => c.MoveEpisodeFile(It.IsAny<EpisodeFile>(), It.IsAny<bool>()), Times.Never());
}
@@ -113,7 +113,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
Mocker.GetMock<IDiskProvider>().Setup(c => c.IsFileLocked(It.IsAny<FileInfo>()))
.Returns(true);
Subject.ProcessDownloadedEpiosdesFolder();
Subject.ProcessDownloadedEpisodesFolder();
VerifyNoImport();
}