diff options
| author | dkanada <dkanada@users.noreply.github.com> | 2020-01-13 14:18:11 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-13 14:18:11 +0900 |
| commit | c3efcbf77e5fa801bf027f5adf88a5ea37da1312 (patch) | |
| tree | e2058be75294b78545f3ce14bf4faf06b50ee145 /tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs | |
| parent | ce7744806c62d54d88acd3e538091f7beaa5601f (diff) | |
| parent | 64baca9facae83832fc45f627f9249b38e37d168 (diff) | |
Merge pull request #2245 from BnMcG/1874-regression-test
Add a test to prevent a regression of absolute path generation behaviour
Diffstat (limited to 'tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs')
| -rw-r--r-- | tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs | 32 |
1 files changed, 32 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..f2a8e447f --- /dev/null +++ b/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs @@ -0,0 +1,32 @@ +using AutoFixture; +using AutoFixture.AutoMoq; +using Emby.Server.Implementations.IO; +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); + Assert.Equal(expectedAbsolutePath, generatedPath); + } + } +} |
