From 43c5d03f9ab64ad36446cd1c7064d6c4cfb5c4d9 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 2 Nov 2016 15:08:21 -0700 Subject: [PATCH] Fix GetAncestorFolders tests under mono --- .../EnsureTest/PathExtensionFixture.cs | 17 +---------- .../PathExtensionFixture.cs | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs b/src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs index 0b5025ade..3388df9ad 100644 --- a/src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs +++ b/src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs @@ -1,7 +1,5 @@ -using FluentAssertions; -using NUnit.Framework; +using NUnit.Framework; using NzbDrone.Common.EnsureThat; -using NzbDrone.Common.Extensions; using NzbDrone.Test.Common; namespace NzbDrone.Common.Test.EnsureTest @@ -24,18 +22,5 @@ public void EnsureLinuxPath(string path) MonoOnly(); Ensure.That(path, () => path).IsValidPath(); } - - [Test] - public void GetAncestorFolders_should_return_all_ancestors_in_path() - { - var path = @"C:\Test\TV\Series Title".AsOsAgnostic(); - var result = path.GetAncestorFolders(); - - result.Count.Should().Be(4); - result[0].Should().Be(@"C:\".AsOsAgnostic()); - result[1].Should().Be(@"Test".AsOsAgnostic()); - result[2].Should().Be(@"TV".AsOsAgnostic()); - result[3].Should().Be(@"Series Title".AsOsAgnostic()); - } } } diff --git a/src/NzbDrone.Common.Test/PathExtensionFixture.cs b/src/NzbDrone.Common.Test/PathExtensionFixture.cs index b72a5cb78..58d28f52e 100644 --- a/src/NzbDrone.Common.Test/PathExtensionFixture.cs +++ b/src/NzbDrone.Common.Test/PathExtensionFixture.cs @@ -243,7 +243,7 @@ public void Config_path_test() } [Test] - public void Sanbox() + public void Sandbox() { GetIAppDirectoryInfo().GetUpdateSandboxFolder().Should().BeEquivalentTo(@"C:\Temp\nzbdrone_update\".AsOsAgnostic()); } @@ -271,5 +271,33 @@ public void GetUpdateLogFolder() { GetIAppDirectoryInfo().GetUpdateLogFolder().Should().BeEquivalentTo(@"C:\NzbDrone\UpdateLogs\".AsOsAgnostic()); } + + [Test] + public void GetAncestorFolders_should_return_all_ancestors_in_path_Windows() + { + WindowsOnly(); + var path = @"C:\Test\TV\Series Title"; + var result = path.GetAncestorFolders(); + + result.Count.Should().Be(4); + result[0].Should().Be(@"C:\"); + result[1].Should().Be(@"Test"); + result[2].Should().Be(@"TV"); + result[3].Should().Be(@"Series Title"); + } + + [Test] + public void GetAncestorFolders_should_return_all_ancestors_in_path_Linux() + { + MonoOnly(); + var path = @"/Test/TV/Series Title"; + var result = path.GetAncestorFolders(); + + result.Count.Should().Be(4); + result[0].Should().Be(@"/"); + result[1].Should().Be(@"Test"); + result[2].Should().Be(@"TV"); + result[3].Should().Be(@"Series Title"); + } } }