Merge pull request #5213 from Bond-009/tests9
Add tests for RequestHelpers.GetItemTypeStrings
This commit is contained in:
commit
6616add8c8
|
@ -38,4 +38,10 @@
|
|||
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
|
||||
<_Parameter1>Jellyfin.Api.Tests</_Parameter1>
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user