From 03cf9a44cf8f3cebc0b13419281099844fd822de Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 16 Jul 2015 23:19:59 -0700 Subject: [PATCH] New: Show download client name in GUI notifications Closes: #642 --- .../Download/DownloadServiceFixture.cs | 21 ++++++++++++------- src/NzbDrone.Core/Download/DownloadService.cs | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs index a45840005..7eadd8746 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs @@ -9,6 +9,7 @@ using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Tv; using NzbDrone.Test.Common; using System.Collections.Generic; +using NzbDrone.Core.Indexers; namespace NzbDrone.Core.Test.Download { @@ -27,8 +28,8 @@ namespace NzbDrone.Core.Test.Download .Returns(_downloadClients); Mocker.GetMock() - .Setup(v => v.GetDownloadClient(It.IsAny())) - .Returns(v => _downloadClients.FirstOrDefault(d => d.Protocol == v)); + .Setup(v => v.GetDownloadClient(It.IsAny())) + .Returns(v => _downloadClients.FirstOrDefault(d => d.Protocol == v)); var episodes = Builder.CreateListOfSize(2) .TheFirst(1).With(s => s.Id = 12) @@ -37,7 +38,7 @@ namespace NzbDrone.Core.Test.Download .Build().ToList(); var releaseInfo = Builder.CreateNew() - .With(v => v.DownloadProtocol = Indexers.DownloadProtocol.Usenet) + .With(v => v.DownloadProtocol = DownloadProtocol.Usenet) .With(v => v.DownloadUrl = "http://test.site/download1.ext") .Build(); @@ -50,20 +51,24 @@ namespace NzbDrone.Core.Test.Download private Mock WithUsenetClient() { - var mock = new Mock(Moq.MockBehavior.Default); + var mock = new Mock(MockBehavior.Default); + mock.SetupGet(s => s.Definition).Returns(Builder.CreateNew().Build()); + _downloadClients.Add(mock.Object); - mock.SetupGet(v => v.Protocol).Returns(Indexers.DownloadProtocol.Usenet); + mock.SetupGet(v => v.Protocol).Returns(DownloadProtocol.Usenet); return mock; } private Mock WithTorrentClient() { - var mock = new Mock(Moq.MockBehavior.Default); + var mock = new Mock(MockBehavior.Default); + mock.SetupGet(s => s.Definition).Returns(Builder.CreateNew().Build()); + _downloadClients.Add(mock.Object); - mock.SetupGet(v => v.Protocol).Returns(Indexers.DownloadProtocol.Torrent); + mock.SetupGet(v => v.Protocol).Returns(DownloadProtocol.Torrent); return mock; } @@ -131,7 +136,7 @@ namespace NzbDrone.Core.Test.Download var mockTorrent = WithTorrentClient(); var mockUsenet = WithUsenetClient(); - _parseResult.Release.DownloadProtocol = Indexers.DownloadProtocol.Torrent; + _parseResult.Release.DownloadProtocol = DownloadProtocol.Torrent; Subject.DownloadReport(_parseResult); diff --git a/src/NzbDrone.Core/Download/DownloadService.cs b/src/NzbDrone.Core/Download/DownloadService.cs index d3625537f..6e19c0963 100644 --- a/src/NzbDrone.Core/Download/DownloadService.cs +++ b/src/NzbDrone.Core/Download/DownloadService.cs @@ -63,7 +63,7 @@ namespace NzbDrone.Core.Download episodeGrabbedEvent.DownloadId = downloadClientId; } - _logger.ProgressInfo("Report sent to download client. {0}", downloadTitle); + _logger.ProgressInfo("Report sent to {0}. {1}", downloadClient.Definition.Name, downloadTitle); _eventAggregator.PublishEvent(episodeGrabbedEvent); } }