PathExtensionsTests.cs 1.0 KB

123456789101112131415161718192021222324252627
  1. using System;
  2. using Emby.Server.Implementations.Library;
  3. using Xunit;
  4. namespace Jellyfin.Server.Implementations.Tests.Library
  5. {
  6. public class PathExtensionsTests
  7. {
  8. [Theory]
  9. [InlineData("Superman: Red Son [imdbid=tt10985510]", "imdbid", "tt10985510")]
  10. [InlineData("Superman: Red Son - tt10985510", "imdbid", "tt10985510")]
  11. [InlineData("Superman: Red Son", "imdbid", null)]
  12. public void GetAttributeValue_ValidArgs_Correct(string input, string attribute, string? expectedResult)
  13. {
  14. Assert.Equal(expectedResult, PathExtensions.GetAttributeValue(input, attribute));
  15. }
  16. [Theory]
  17. [InlineData("", "")]
  18. [InlineData("Superman: Red Son [imdbid=tt10985510]", "")]
  19. [InlineData("", "imdbid")]
  20. public void GetAttributeValue_EmptyString_ThrowsArgumentException(string input, string attribute)
  21. {
  22. Assert.Throws<ArgumentException>(() => PathExtensions.GetAttributeValue(input, attribute));
  23. }
  24. }
  25. }