mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-11 04:42:18 +01:00
Merge pull request #2245 from BnMcG/1874-regression-test
Add a test to prevent a regression of absolute path generation behaviour
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<RootNamespace>Jellyfin.Server.Implementations.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoFixture" Version="4.11.0" />
|
||||
<PackageReference Include="AutoFixture.AutoMoq" Version="4.11.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||
<PackageReference Include="Moq" Version="4.13.1" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Emby.Server.Implementations\Emby.Server.Implementations.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user