ManagedFileSystemTests.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. using AutoFixture;
  2. using AutoFixture.AutoMoq;
  3. using Emby.Server.Implementations.IO;
  4. using Xunit;
  5. namespace Jellyfin.Server.Implementations.Tests.IO
  6. {
  7. public class ManagedFileSystemTests
  8. {
  9. private readonly IFixture _fixture;
  10. private readonly ManagedFileSystem _sut;
  11. public ManagedFileSystemTests()
  12. {
  13. _fixture = new Fixture().Customize(new AutoMoqCustomization { ConfigureMembers = true });
  14. _sut = _fixture.Create<ManagedFileSystem>();
  15. }
  16. [Theory]
  17. [InlineData("/Volumes/Library/Sample/Music/Playlists/", "../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Beethoven/Misc/Moonlight Sonata.mp3")]
  18. [InlineData("/Volumes/Library/Sample/Music/Playlists/", "../../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Beethoven/Misc/Moonlight Sonata.mp3")]
  19. [InlineData("/Volumes/Library/Sample/Music/Playlists/", "Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Playlists/Beethoven/Misc/Moonlight Sonata.mp3")]
  20. public void MakeAbsolutePathCorrectlyHandlesRelativeFilePaths(
  21. string folderPath,
  22. string filePath,
  23. string expectedAbsolutePath)
  24. {
  25. var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath);
  26. Assert.Equal(expectedAbsolutePath, generatedPath);
  27. }
  28. }
  29. }