diff options
| author | artiume <siderite@gmail.com> | 2020-01-26 09:33:31 -0500 |
|---|---|---|
| committer | artiume <siderite@gmail.com> | 2020-01-26 09:33:31 -0500 |
| commit | 918df5e352889a5d990e2a9feb1e838f3acc9a39 (patch) | |
| tree | 8c029e97e7e55ce5780709f047710da0807668cb /tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs | |
| parent | 0cbae4a06d49acccfd7a757039f7f6725cdc53a5 (diff) | |
| parent | e58aa57ed75417f8eb80c55fb1b782153f924fb8 (diff) | |
Merge remote-tracking branch 'jellyfin/master'
Diffstat (limited to 'tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs')
| -rw-r--r-- | tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs | 43 |
1 files changed, 43 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..e324002f0 --- /dev/null +++ b/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs @@ -0,0 +1,43 @@ +using System; +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); + } + } + } +} |
