Fixed: mono version check will check running mono version instead running another version

This commit is contained in:
Mark McDowall
2014-07-24 23:37:32 -07:00
parent 41583a8c67
commit a4500606a9
6 changed files with 72 additions and 42 deletions
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
using NzbDrone.Common.Processes;
using NzbDrone.Core.HealthCheck.Checks;
@@ -18,16 +17,9 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
private void GivenOutput(string version)
{
Mocker.GetMock<IProcessProvider>()
.Setup(s => s.StartAndCapture("mono", "--version"))
.Returns(new ProcessOutput
{
Standard = new List<string>
{
String.Format("Mono JIT compiler version {0} (Debian {0}-8)", version),
"Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com"
}
});
Mocker.GetMock<IRuntimeProvider>()
.Setup(s => s.GetVersion())
.Returns(String.Format("{0} (tarball Wed Sep 25 16:35:44 CDT 2013)", version));
}
[Test]
@@ -46,6 +38,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Subject.Check().ShouldBeWarning();
}
[Test]
public void should_return_warning_when_mono_2_10_2()
{
GivenOutput("2.10.2");
Subject.Check().ShouldBeWarning();
}
[Test]
public void should_return_ok_when_mono_3_2()
{
@@ -85,22 +85,5 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Subject.Check().ShouldBeOk();
}
[Test]
public void should_return_ok_when_mono_3_6_1_with_custom_output()
{
Mocker.GetMock<IProcessProvider>()
.Setup(s => s.StartAndCapture("mono", "--version"))
.Returns(new ProcessOutput
{
Standard = new List<string>
{
"Mono JIT compiler version 3.6.1 (master/fce3972 Fri Jul 4 01:12:43 CEST 2014)",
"Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com"
}
});
Subject.Check().ShouldBeOk();
}
}
}