diff options
Diffstat (limited to 'tests/Jellyfin.Server.Implementations.Tests/Data/ItemTypeLookupTests.cs')
| -rw-r--r-- | tests/Jellyfin.Server.Implementations.Tests/Data/ItemTypeLookupTests.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Data/ItemTypeLookupTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Data/ItemTypeLookupTests.cs new file mode 100644 index 0000000000..a60622902b --- /dev/null +++ b/tests/Jellyfin.Server.Implementations.Tests/Data/ItemTypeLookupTests.cs @@ -0,0 +1,26 @@ +using System; +using System.Linq; +using Emby.Server.Implementations.Data; +using Jellyfin.Data.Enums; +using MediaBrowser.Controller.Entities; +using Xunit; + +namespace Jellyfin.Server.Implementations.Tests.Data; + +public class ItemTypeLookupTests +{ + public static TheoryData<BaseItemKind> MappedKinds() + => new(new ItemTypeLookup().BaseItemKindNames.Keys); + + [Theory] + [MemberData(nameof(MappedKinds))] + public void BaseItemKindNames_Kind_NamesAnItemType(BaseItemKind kind) + { + var name = new ItemTypeLookup().BaseItemKindNames[kind]; + + var type = AppDomain.CurrentDomain.GetAssemblies().Select(a => a.GetType(name)).FirstOrDefault(t => t is not null); + + Assert.NotNull(type); + Assert.True(typeof(BaseItem).IsAssignableFrom(type), $"{name} is not an item type."); + } +} |
