1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-29 11:05:44 +00:00

Fixed: Health Checks on mono now shows correct wiki links.

This commit is contained in:
Taloth Saldono 2015-02-06 21:18:13 +01:00
parent 9ac3a1e094
commit 6c22a5ffdb
3 changed files with 35 additions and 3 deletions

View file

@ -0,0 +1,24 @@
using System;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.HealthCheck;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck
{
[TestFixture]
public class HealthCheckFixture : CoreTest
{
private const string WikiRoot = "https://github.com/Sonarr/Sonarr/wiki/";
[TestCase("I blew up because of some weird user mistake", null, WikiRoot + "Health-checks#i-blew-up-because-of-some-weird-user-mistake")]
[TestCase("I blew up because of some weird user mistake", "#my-health-check", WikiRoot + "Health-checks#my-health-check")]
[TestCase("I blew up because of some weird user mistake", "Custom-Page#my-health-check", WikiRoot + "Custom-Page#my-health-check")]
public void should_format_wiki_url(string message, string wikiFragment, string expectedUrl)
{
var subject = new NzbDrone.Core.HealthCheck.HealthCheck(typeof(HealthCheckBase), HealthCheckResult.Warning, message, wikiFragment);
subject.WikiUrl.Should().Be(expectedUrl);
}
}
}

View file

@ -178,6 +178,7 @@
<Compile Include="HealthCheck\Checks\MonoVersionCheckFixture.cs" />
<Compile Include="HealthCheck\Checks\RootFolderCheckFixture.cs" />
<Compile Include="HealthCheck\Checks\UpdateCheckFixture.cs" />
<Compile Include="HealthCheck\HealthCheckFixture.cs" />
<Compile Include="HistoryTests\HistoryRepositoryFixture.cs" />
<Compile Include="HistoryTests\HistoryServiceFixture.cs" />
<Compile Include="Housekeeping\Housekeepers\CleanupAdditionalNamingSpecsFixture.cs" />

View file

@ -34,10 +34,17 @@ private static String MakeWikiFragment(String message)
private static Uri MakeWikiUrl(String fragment)
{
var rootUri = new Uri("https://github.com/NzbDrone/NzbDrone/wiki/Health-checks");
var fragmentUri = new Uri(fragment, UriKind.Relative);
var rootUri = new Uri("https://github.com/Sonarr/Sonarr/wiki/Health-checks");
if (fragment.StartsWith("#"))
{ // Mono doesn't understand # and generates a different url than windows.
return new Uri(rootUri + fragment);
}
else
{
var fragmentUri = new Uri(fragment, UriKind.Relative);
return new Uri(rootUri, fragmentUri);
return new Uri(rootUri, fragmentUri);
}
}
}