ManagedFileSystemTests.cs 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. using AutoFixture;
  2. using AutoFixture.AutoMoq;
  3. using Emby.Server.Implementations.IO;
  4. using Xunit;
  5. namespace Emby.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. public void MakeAbsolutePathCorrectlyHandlesRelativeFilePaths(
  20. string folderPath,
  21. string filePath,
  22. string expectedAbsolutePath)
  23. {
  24. var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath);
  25. Assert.Equal(expectedAbsolutePath, generatedPath);
  26. }
  27. }
  28. }