diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/DSMInfoProviderFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/DSMInfoProviderFixture.cs index 005cf3012..5a6c1e73a 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/DSMInfoProviderFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/DSMInfoProviderFixture.cs @@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests } [Test] - public void should_return_version(string versionExpected) + public void should_return_version() { GivenValidResponse(); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs index 3f99bdaa7..35bf3f0ba 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs @@ -182,6 +182,21 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests .Returns(_downloadStationConfigItems); } + protected void GivenApiVersions() + { + Mocker.GetMock() + .Setup(s => s.GetApiInfo(It.IsAny())) + .Returns(new DiskStationApiInfo() { Name = "Task", MinVersion = 1, MaxVersion = 2 }); + + Mocker.GetMock() + .Setup(s => s.GetApiInfo(It.IsAny())) + .Returns(new DiskStationApiInfo() { Name = "Info", MinVersion = 1, MaxVersion = 3 }); + + Mocker.GetMock() + .Setup(s => s.GetApiInfo(It.IsAny())) + .Returns(new DiskStationApiInfo() { Name = "File", MinVersion = 1, MaxVersion = 2 }); + } + protected void GivenSharedFolder() { Mocker.GetMock() @@ -245,6 +260,25 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests Mocker.GetMock() .Setup(d => d.GetTasks(_settings)) .Returns(tasks); + } + + protected void GivenDSMVersion(string version) + { + Mocker.GetMock() + .Setup(d => d.GetDSMVersion(It.IsAny())) + .Returns(new Version(version)); + } + + [TestCase("6.0.0", 0)] + [TestCase("5.0.0", 1)] + public void TestConnection_should_return_validation_failure_as_expected(string version, int count) + { + GivenApiVersions(); + GivenDSMVersion(version); + + var result = Subject.Test(); + + result.Errors.Should().HaveCount(count); } [Test]