diff options
| author | Bond_009 <bond.009@outlook.com> | 2021-02-11 17:46:27 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2021-02-11 18:21:08 +0100 |
| commit | 97935d2cd2b5b75e6ca515c99f5821045a06a019 (patch) | |
| tree | 5350fc055d8cd41773e2334e04556d075c10ba62 | |
| parent | a2ac4d3dd77623ada99d76a2bdccbd076246253a (diff) | |
Add tests for RequestHelpers.GetItemTypeStrings
| -rw-r--r-- | Jellyfin.Api/Jellyfin.Api.csproj | 6 | ||||
| -rw-r--r-- | tests/Jellyfin.Api.Tests/Helpers/RequestHelpersTests.cs | 34 |
2 files changed, 38 insertions, 2 deletions
diff --git a/Jellyfin.Api/Jellyfin.Api.csproj b/Jellyfin.Api/Jellyfin.Api.csproj index c2f4ab522..ef105fdce 100644 --- a/Jellyfin.Api/Jellyfin.Api.csproj +++ b/Jellyfin.Api/Jellyfin.Api.csproj @@ -38,4 +38,10 @@ <CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet> </PropertyGroup> + <ItemGroup> + <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo"> + <_Parameter1>Jellyfin.Api.Tests</_Parameter1> + </AssemblyAttribute> + </ItemGroup> + </Project> diff --git a/tests/Jellyfin.Api.Tests/Helpers/RequestHelpersTests.cs b/tests/Jellyfin.Api.Tests/Helpers/RequestHelpersTests.cs index 606041c7f..97e441b1d 100644 --- a/tests/Jellyfin.Api.Tests/Helpers/RequestHelpersTests.cs +++ b/tests/Jellyfin.Api.Tests/Helpers/RequestHelpersTests.cs @@ -6,11 +6,11 @@ using Xunit; namespace Jellyfin.Api.Tests.Helpers { - public class RequestHelpersTests + public static class RequestHelpersTests { [Theory] [MemberData(nameof(GetOrderBy_Success_TestData))] - public void GetOrderBy_Success(IReadOnlyList<string> sortBy, IReadOnlyList<SortOrder> requestedSortOrder, (string, SortOrder)[] expected) + public static void GetOrderBy_Success(IReadOnlyList<string> sortBy, IReadOnlyList<SortOrder> requestedSortOrder, (string, SortOrder)[] expected) { Assert.Equal(expected, RequestHelpers.GetOrderBy(sortBy, requestedSortOrder)); } @@ -55,5 +55,35 @@ namespace Jellyfin.Api.Tests.Helpers } }; } + + [Fact] + public static void GetItemTypeStrings_Empty_Empty() + { + Assert.Empty(RequestHelpers.GetItemTypeStrings(Array.Empty<BaseItemKind>())); + } + + [Fact] + public static void GetItemTypeStrings_Valid_Success() + { + BaseItemKind[] input = + { + BaseItemKind.AggregateFolder, + BaseItemKind.Audio, + BaseItemKind.BasePluginFolder, + BaseItemKind.CollectionFolder + }; + + string[] expected = + { + "AggregateFolder", + "Audio", + "BasePluginFolder", + "CollectionFolder" + }; + + var res = RequestHelpers.GetItemTypeStrings(input); + + Assert.Equal(expected, res); + } } } |
