1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-23 22:25:14 -04:00
Files
Radarr/src/NzbDrone.Core.Test/NotificationTests/SynologyIndexerFixture.cs
T
Leonardo Galli 7cfa0531dc 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
2017-03-06 22:23:25 +01:00

100 lines
2.8 KiB
C#

using System.Collections.Generic;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Notifications;
using NzbDrone.Core.Notifications.Synology;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.NotificationTests
{
[TestFixture]
public class SynologyIndexerFixture : CoreTest<SynologyIndexer>
{
private Movie _movie;
private DownloadMessage _upgrade;
[SetUp]
public void SetUp()
{
_movie = new Movie()
{
Path = @"C:\Test\".AsOsAgnostic()
};
_upgrade = new DownloadMessage()
{
Movie = _movie,
MovieFile = new MovieFile
{
RelativePath = "file1.S01E01E02.mkv"
},
OldMovieFiles = new List<MovieFile>
{
new MovieFile
{
RelativePath = "file1.S01E01.mkv"
},
new MovieFile
{
RelativePath = "file1.S01E02.mkv"
}
}
};
Subject.Definition = new NotificationDefinition
{
Settings = new SynologyIndexerSettings
{
UpdateLibrary = true
}
};
}
[Test]
public void should_not_update_library_if_disabled()
{
(Subject.Definition.Settings as SynologyIndexerSettings).UpdateLibrary = false;
Subject.OnMovieRename(_movie);
Mocker.GetMock<ISynologyIndexerProxy>()
.Verify(v => v.UpdateFolder(_movie.Path), Times.Never());
}
[Test]
public void should_remove_old_episodes_on_upgrade()
{
Subject.OnDownload(_upgrade);
Mocker.GetMock<ISynologyIndexerProxy>()
.Verify(v => v.DeleteFile(@"C:\Test\file1.S01E01.mkv".AsOsAgnostic()), Times.Once());
Mocker.GetMock<ISynologyIndexerProxy>()
.Verify(v => v.DeleteFile(@"C:\Test\file1.S01E02.mkv".AsOsAgnostic()), Times.Once());
}
[Test]
public void should_add_new_episode_on_upgrade()
{
Subject.OnDownload(_upgrade);
Mocker.GetMock<ISynologyIndexerProxy>()
.Verify(v => v.AddFile(@"C:\Test\file1.S01E01E02.mkv".AsOsAgnostic()), Times.Once());
}
[Test]
public void should_update_entire_series_folder_on_rename()
{
Subject.OnMovieRename(_movie);
Mocker.GetMock<ISynologyIndexerProxy>()
.Verify(v => v.UpdateFolder(@"C:\Test\".AsOsAgnostic()), Times.Once());
}
}
}