Fixed: Delete unreferenced files

pull/909/head
ta264 5 years ago committed by Qstick
parent ca6ff0d067
commit e095fe00af

@ -1,9 +0,0 @@
namespace NzbDrone.Common.EnvironmentInfo
{
public interface IOperatingSystemVersionInfo
{
string Version { get; }
string Name { get; }
string FullName { get; }
}
}

@ -1,61 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using NLog;
using NUnit.Framework;
namespace NzbDrone.Core.Test.Framework.AutoMoq
{
[TestFixture]
class TestBaseTests : TestBase
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Test]
public void Test_should_pass_when_no_exceptions_are_logged()
{
Logger.Info("Everything is fine and dandy!");
}
[Test]
public void Test_should_pass_when_errors_are_excpected()
{
Logger.Error("I knew this would happer");
ExceptionVerification.ExcpectedErrors(1);
}
[Test]
public void Test_should_pass_when_warns_are_excpected()
{
Logger.Warn("I knew this would happer");
ExceptionVerification.ExcpectedWarns(1);
}
[Test]
public void Test_should_pass_when_warns_are_ignored()
{
Logger.Warn("I knew this would happer");
Logger.Warn("I knew this would happer");
Logger.Warn("I knew this would happer");
ExceptionVerification.IgnoreWarns();
}
[Test]
public void Test_should_pass_when_errors_are_ignored()
{
Logger.Error("I knew this would happer");
Logger.Error("I knew this would happer");
Logger.Error("I knew this would happer");
ExceptionVerification.IgnoreErrors();
}
[Test]
public void Test_should_pass_when_exception_type_is_ignored()
{
Logger.ErrorException("bad exception", new WebException("Test"));
ExceptionVerification.MarkInconclusive(typeof(WebException));
}
}
}

@ -1,198 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
using FluentValidation;
using FluentValidation.Results;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.Exceptions;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Music;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.MusicTests
{
[TestFixture]
public class AddAlbumFixture : CoreTest<AddAlbumService>
{
private Album _fakeAlbum;
private AlbumRelease _fakeRelease;
private List<ArtistMetadata> _fakeArtists;
private readonly string _fakeArtistForeignId = "xxx-xxx-xxx";
[SetUp]
public void Setup()
{
_fakeAlbum = Builder<Album>
.CreateNew()
.Build();
_fakeRelease = Builder<AlbumRelease>
.CreateNew()
.Build();
_fakeRelease.Tracks = new List<Track>();
_fakeAlbum.AlbumReleases = new List<AlbumRelease> {_fakeRelease};
_fakeArtists = Builder<ArtistMetadata>.CreateListOfSize(1)
.TheFirst(1)
.With(x => x.ForeignArtistId = _fakeArtistForeignId)
.Build() as List<ArtistMetadata>;
Mocker.GetMock<IReleaseService>()
.Setup(x => x.GetReleasesForRefresh(It.IsAny<int>(), It.IsAny<IEnumerable<string>>()))
.Returns(new List<AlbumRelease>());
Mocker.GetMock<IArtistMetadataRepository>()
.Setup(x => x.FindById(_fakeArtistForeignId))
.Returns(_fakeArtists[0]);
}
private void GivenValidAlbum(string lidarrId)
{
Mocker.GetMock<IProvideAlbumInfo>()
.Setup(s => s.GetAlbumInfo(lidarrId))
.Returns(new Tuple<string, Album, List<ArtistMetadata>>(_fakeArtistForeignId, _fakeAlbum, _fakeArtists));
}
[Test]
public void should_be_able_to_add_an_album_without_passing_in_title()
{
var newAlbum = new Album
{
ForeignAlbumId = "ce09ea31-3d4a-4487-a797-e315175457a0"
};
GivenValidAlbum(newAlbum.ForeignAlbumId);
var album = Subject.AddAlbum(newAlbum);
album.Title.Should().Be(_fakeAlbum.Title);
}
[Test]
public void should_throw_if_album_cannot_be_found()
{
var newAlbum = new Album
{
ForeignAlbumId = "ce09ea31-3d4a-4487-a797-e315175457a0"
};
Mocker.GetMock<IProvideAlbumInfo>()
.Setup(s => s.GetAlbumInfo(newAlbum.ForeignAlbumId))
.Throws(new AlbumNotFoundException(newAlbum.ForeignAlbumId));
Assert.Throws<ValidationException>(() => Subject.AddAlbum(newAlbum));
ExceptionVerification.ExpectedErrors(1);
}
[Test]
public void should_not_add_if_no_releases()
{
_fakeAlbum.AlbumReleases = new List<AlbumRelease>();
GivenValidAlbum(_fakeAlbum.ForeignAlbumId);
Subject.AddAlbum(_fakeAlbum).Should().BeNull();
Mocker.GetMock<IAlbumService>()
.Verify(x => x.AddAlbum(It.IsAny<Album>()), Times.Never());
}
[Test]
public void should_not_add_item_in_list_if_no_releases()
{
_fakeAlbum.AlbumReleases = new List<AlbumRelease>();
GivenValidAlbum(_fakeAlbum.ForeignAlbumId);
Subject.AddAlbums(new List<Album> { _fakeAlbum }).Should().BeEquivalentTo(new List<Album> { null });
Mocker.GetMock<IAlbumService>()
.Verify(x => x.AddAlbum(It.IsAny<Album>()), Times.Never());
}
[Test]
public void should_not_add_duplicate_releases()
{
var newAlbum = Builder<Album>.CreateNew().Build();
var releases = Builder<AlbumRelease>.CreateListOfSize(10)
.All()
.With(x => x.AlbumId = newAlbum.Id)
.TheFirst(4)
.With(x => x.ForeignReleaseId = "DuplicateId1")
.TheLast(1)
.With(x => x.ForeignReleaseId = "DuplicateId2")
.Build() as List<AlbumRelease>;
newAlbum.AlbumReleases = releases;
var existingReleases = Builder<AlbumRelease>.CreateListOfSize(1)
.All()
.With(x => x.ForeignReleaseId = "DuplicateId2")
.Build() as List<AlbumRelease>;
Mocker.GetMock<IReleaseService>()
.Setup(x => x.GetReleasesForRefresh(newAlbum.Id, It.IsAny<IEnumerable<string>>()))
.Returns(existingReleases);
var updatedReleases = Subject.AddAlbumReleases(newAlbum);
updatedReleases.Should().HaveCount(7);
Mocker.GetMock<IReleaseService>()
.Verify(x => x.UpdateMany(It.Is<List<AlbumRelease>>(l => l.Count == 1 && l.Select(r => r.ForeignReleaseId).Distinct().Count() == 1)), Times.Once());
Mocker.GetMock<IReleaseService>()
.Verify(x => x.InsertMany(It.Is<List<AlbumRelease>>(l => l.Count == 6 &&
l.Select(r => r.ForeignReleaseId).Distinct().Count() == 6 &&
!l.Select(r => r.ForeignReleaseId).Contains("DuplicateId2"))),
Times.Once());
}
[Test]
public void should_only_add_one_monitored_release_ignoring_skyhook()
{
var newAlbum = Builder<Album>.CreateNew().Build();
var releases = Builder<AlbumRelease>.CreateListOfSize(10)
.All()
.With(x => x.Monitored = true)
.Build() as List<AlbumRelease>;
newAlbum.AlbumReleases = releases;
var updatedReleases = Subject.AddAlbumReleases(newAlbum);
updatedReleases.Count(x => x.Monitored).Should().Be(1);
}
[Test]
public void should_only_add_one_monitored_release_combining_with_existing()
{
var newAlbum = Builder<Album>.CreateNew().Build();
var releases = Builder<AlbumRelease>.CreateListOfSize(10)
.All()
.With(x => x.Monitored = false)
.Build() as List<AlbumRelease>;
releases[1].Monitored = true;
newAlbum.AlbumReleases = releases;
var existingReleases = Builder<AlbumRelease>.CreateListOfSize(1)
.All()
.With(x => x.ForeignReleaseId = releases[0].ForeignReleaseId)
.With(x => x.Monitored = true)
.Build() as List<AlbumRelease>;
Mocker.GetMock<IReleaseService>()
.Setup(x => x.GetReleasesForRefresh(newAlbum.Id, It.IsAny<IEnumerable<string>>()))
.Returns(existingReleases);
var updatedReleases = Subject.AddAlbumReleases(newAlbum);
updatedReleases.Count(x => x.Monitored).Should().Be(1);
}
}
}

@ -1,63 +0,0 @@
using NUnit.Framework;
using NzbDrone.Core.Notifications.Growl;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.NotificationTests
{
[Explicit]
[TestFixture]
public class GrowlProviderTest : CoreTest
{
[Test]
public void Register_should_add_new_application_to_local_growl_instance()
{
Mocker.Resolve<GrowlProvider>().Register("localhost", 23053, "");
Mocker.VerifyAllMocks();
}
[Test]
public void TestNotification_should_send_a_message_to_local_growl_instance()
{
Mocker.Resolve<GrowlProvider>().TestNotification("localhost", 23053, "");
Mocker.VerifyAllMocks();
}
[Test]
public void OnGrab_should_send_a_message_to_local_growl_instance()
{
Mocker.Resolve<GrowlProvider>().SendNotification("Episode Grabbed", "Series Title - 1x05 - Episode Title", "GRAB", "localhost", 23053, "");
Mocker.VerifyAllMocks();
}
[Test]
public void OnDownload_should_send_a_message_to_local_growl_instance()
{
Mocker.Resolve<GrowlProvider>().SendNotification("Episode Downloaded", "Series Title - 1x05 - Episode Title", "DOWNLOAD", "localhost", 23053, "");
Mocker.VerifyAllMocks();
}
}
}
Loading…
Cancel
Save