From 5a5da33f44b933215c95947c479ded1cdbadbcd9 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Tue, 17 Sep 2024 23:34:12 +0200 Subject: Apply review suggestions --- .../Dlna/ContainerHelperTests.cs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') diff --git a/tests/Jellyfin.Model.Tests/Dlna/ContainerHelperTests.cs b/tests/Jellyfin.Model.Tests/Dlna/ContainerHelperTests.cs index 68f8d94c72..1ad4bed567 100644 --- a/tests/Jellyfin.Model.Tests/Dlna/ContainerHelperTests.cs +++ b/tests/Jellyfin.Model.Tests/Dlna/ContainerHelperTests.cs @@ -40,6 +40,11 @@ public class ContainerHelperTests public void ContainsContainer_NotInList_ReturnsFalse(string container, string? extension) { Assert.False(ContainerHelper.ContainsContainer(container, extension)); + + if (extension is not null) + { + Assert.False(ContainerHelper.ContainsContainer(container, extension.AsSpan())); + } } [Theory] @@ -51,4 +56,28 @@ public class ContainerHelperTests { Assert.True(ContainerHelper.ContainsContainer(container, extension.AsSpan())); } + + [Theory] + [InlineData(new string[] { "mp3", "mpeg" }, false, "mpeg")] + [InlineData(new string[] { "mp3", "mpeg", "avi" }, false, "avi")] + [InlineData(new string[] { "mp3", "", "avi" }, false, "mp3")] + [InlineData(new string[] { "mp3", "mpeg" }, true, "avi")] + [InlineData(new string[] { "mp3", "mpeg", "avi" }, true, "mkv")] + [InlineData(new string[] { "mp3", "", "avi" }, true, "")] + public void ContainsContainer_ThreeArgs_InList_ReturnsTrue(string[] containers, bool isNegativeList, string inputContainer) + { + Assert.True(ContainerHelper.ContainsContainer(containers, isNegativeList, inputContainer)); + } + + [Theory] + [InlineData(new string[] { "mp3", "mpeg" }, false, "avi")] + [InlineData(new string[] { "mp3", "mpeg", "avi" }, false, "mkv")] + [InlineData(new string[] { "mp3", "", "avi" }, false, "")] + [InlineData(new string[] { "mp3", "mpeg" }, true, "mpeg")] + [InlineData(new string[] { "mp3", "mpeg", "avi" }, true, "mp3")] + [InlineData(new string[] { "mp3", "", "avi" }, true, "avi")] + public void ContainsContainer_ThreeArgs_InList_ReturnsFalse(string[] containers, bool isNegativeList, string inputContainer) + { + Assert.False(ContainerHelper.ContainsContainer(containers, isNegativeList, inputContainer)); + } } -- cgit v1.2.3