mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-19 20:09:03 -07:00
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using System;
|
|
using Emby.Server.Implementations.Library;
|
|
using Xunit;
|
|
|
|
namespace Jellyfin.Server.Implementations.Tests.Library
|
|
{
|
|
public class PathExtensionsTests
|
|
{
|
|
[Theory]
|
|
[InlineData("Superman: Red Son [imdbid=tt10985510]", "imdbid", "tt10985510")]
|
|
[InlineData("Superman: Red Son - tt10985510", "imdbid", "tt10985510")]
|
|
[InlineData("Superman: Red Son", "imdbid", null)]
|
|
[InlineData("Superman: Red Son", "something", null)]
|
|
public void GetAttributeValue_ValidArgs_Correct(string input, string attribute, string? expectedResult)
|
|
{
|
|
Assert.Equal(expectedResult, PathExtensions.GetAttributeValue(input, attribute));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("", "")]
|
|
[InlineData("Superman: Red Son [imdbid=tt10985510]", "")]
|
|
[InlineData("", "imdbid")]
|
|
public void GetAttributeValue_EmptyString_ThrowsArgumentException(string input, string attribute)
|
|
{
|
|
Assert.Throws<ArgumentException>(() => PathExtensions.GetAttributeValue(input, attribute));
|
|
}
|
|
}
|
|
}
|