diff options
| author | Anthony Lavado <anthony@lavado.ca> | 2020-02-12 02:01:56 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-12 02:01:56 -0500 |
| commit | 42066ee326277fb181f609a8530cf419569efbf8 (patch) | |
| tree | 4c119429d3689c03ed267880a4257cb6402c45ae /tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs | |
| parent | 081d942d0361a4ad8aa918edcbb2f20c4c3f8471 (diff) | |
| parent | 684568e6d2ef163c91fa5faf26600c16acf4b0b8 (diff) | |
Merge branch 'master' into transcoding-throttling
Diffstat (limited to 'tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs')
| -rw-r--r-- | tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs b/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs new file mode 100644 index 000000000..671c59b2e --- /dev/null +++ b/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs @@ -0,0 +1,42 @@ +using AutoFixture; +using AutoFixture.AutoMoq; +using Emby.Server.Implementations.IO; +using MediaBrowser.Model.System; +using Xunit; + +namespace Jellyfin.Server.Implementations.Tests.IO +{ + public class ManagedFileSystemTests + { + private readonly IFixture _fixture; + private readonly ManagedFileSystem _sut; + + public ManagedFileSystemTests() + { + _fixture = new Fixture().Customize(new AutoMoqCustomization { ConfigureMembers = true }); + _sut = _fixture.Create<ManagedFileSystem>(); + } + + [Theory] + [InlineData("/Volumes/Library/Sample/Music/Playlists/", "../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Beethoven/Misc/Moonlight Sonata.mp3")] + [InlineData("/Volumes/Library/Sample/Music/Playlists/", "../../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Beethoven/Misc/Moonlight Sonata.mp3")] + [InlineData("/Volumes/Library/Sample/Music/Playlists/", "Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Playlists/Beethoven/Misc/Moonlight Sonata.mp3")] + public void MakeAbsolutePathCorrectlyHandlesRelativeFilePaths( + string folderPath, + string filePath, + string expectedAbsolutePath) + { + var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath); + + if (MediaBrowser.Common.System.OperatingSystem.Id == OperatingSystemId.Windows) + { + var expectedWindowsPath = expectedAbsolutePath.Replace('/', '\\'); + Assert.Equal(expectedWindowsPath, generatedPath.Split(':')[1]); + } + else + { + Assert.Equal(expectedAbsolutePath, generatedPath); + } + } + } +} |
