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.
Radarr/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadServiceFixtu...

83 lines
2.4 KiB

using System.Collections.Generic;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.Download;
using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.History;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Indexers;
using System.Linq;
namespace NzbDrone.Core.Test.Download.TrackedDownloads
{
[TestFixture]
public class TrackedDownloadServiceFixture : CoreTest<TrackedDownloadService>
{
[SetUp]
public void Setup()
{
}
private void GivenDownloadHistory()
{
Mocker.GetMock<IHistoryService>()
.Setup(s => s.FindByDownloadId(It.Is<string>(sr => sr == "35238")))
.Returns(new List<History.History>(){
new History.History(){
DownloadId = "35238",
SourceTitle = "TV Series S01",
Fixed all tests and even added some new ones :) (#835) * First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
7 years ago
MovieId = 3,
}
});
}
[Test]
public void should_track_downloads_using_the_source_title_if_it_cannot_be_found_using_the_download_title()
{
GivenDownloadHistory();
Fixed all tests and even added some new ones :) (#835) * First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
7 years ago
var remoteEpisode = new RemoteMovie
{
Fixed all tests and even added some new ones :) (#835) * First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
7 years ago
Movie = new Movie() { Id = 3 },
Fixed all tests and even added some new ones :) (#835) * First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
7 years ago
ParsedMovieInfo = new ParsedMovieInfo()
{
Fixed all tests and even added some new ones :) (#835) * First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
7 years ago
MovieTitle = "A Movie",
Year = 1998
}
};
Mocker.GetMock<IParsingService>()
Fixed all tests and even added some new ones :) (#835) * First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
7 years ago
.Setup(s => s.Map(It.Is<ParsedMovieInfo>(i => i.MovieTitle == "A Movie"), It.IsAny<string>(), null))
.Returns(new MappingResult{RemoteMovie = remoteEpisode});
ParseMovieTitle();
var client = new DownloadClientDefinition()
{
Id = 1,
Protocol = DownloadProtocol.Torrent
};
var item = new DownloadClientItem()
{
Fixed all tests and even added some new ones :) (#835) * First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
7 years ago
Title = "A Movie 1998",
DownloadId = "35238",
};
var trackedDownload = Subject.TrackDownload(client, item);
trackedDownload.Should().NotBeNull();
Fixed all tests and even added some new ones :) (#835) * First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
7 years ago
trackedDownload.RemoteMovie.Should().NotBeNull();
trackedDownload.RemoteMovie.Movie.Should().NotBeNull();
trackedDownload.RemoteMovie.Movie.Id.Should().Be(3);
}
}
}