1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2025-01-31 03:11:51 +00:00

Hard test on dev nzbget version as requested.

This commit is contained in:
Taloth Saldono 2015-04-11 09:07:35 +02:00
parent b62d36bdbe
commit 923488bc02
2 changed files with 9 additions and 30 deletions

View file

@ -343,40 +343,19 @@ public void should_remap_storage_if_mounted()
result.OutputPath.Should().Be(@"O:\mymount\Droned.S01E01.Pilot.1080p.WEB-DL-DRONE".AsOsAgnostic()); result.OutputPath.Should().Be(@"O:\mymount\Droned.S01E01.Pilot.1080p.WEB-DL-DRONE".AsOsAgnostic());
} }
[Test] [TestCase("11.0", false)]
public void should_pass_test_if_version_high_enough() [TestCase("12.0", true)]
[TestCase("11.0-b30ef0134", false)]
[TestCase("13.0-b30ef0134", true)]
public void should_test_version(string version, bool expected)
{ {
Mocker.GetMock<INzbgetProxy>() Mocker.GetMock<INzbgetProxy>()
.Setup(v => v.GetVersion(It.IsAny<NzbgetSettings>())) .Setup(v => v.GetVersion(It.IsAny<NzbgetSettings>()))
.Returns("12.0"); .Returns(version);
var error = Subject.Test(); var error = Subject.Test();
error.IsValid.Should().BeTrue(); error.IsValid.Should().Be(expected);
}
[Test]
public void should_fail_test_if_version_too_low()
{
Mocker.GetMock<INzbgetProxy>()
.Setup(v => v.GetVersion(It.IsAny<NzbgetSettings>()))
.Returns("11.0");
var error = Subject.Test();
error.IsValid.Should().BeFalse();
}
[Test]
public void should_ignore_version_test_if_development_version()
{
Mocker.GetMock<INzbgetProxy>()
.Setup(v => v.GetVersion(It.IsAny<NzbgetSettings>()))
.Returns("12.0-dev");
var error = Subject.Test();
error.IsValid.Should().BeTrue();
} }
} }
} }

View file

@ -258,9 +258,9 @@ private ValidationFailure TestConnection()
{ {
try try
{ {
var version = _proxy.GetVersion(Settings); var version = _proxy.GetVersion(Settings).Split('-')[0];
if (!version.Contains('-') && Version.Parse(version) < Version.Parse("12.0")) if (Version.Parse(version) < Version.Parse("12.0"))
{ {
return new ValidationFailure(string.Empty, "Nzbget version too low, need 12.0 or higher"); return new ValidationFailure(string.Empty, "Nzbget version too low, need 12.0 or higher");
} }