aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Implementations.Tests/Playlists/PlaylistManagerTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Jellyfin.Server.Implementations.Tests/Playlists/PlaylistManagerTests.cs')
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Playlists/PlaylistManagerTests.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Playlists/PlaylistManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Playlists/PlaylistManagerTests.cs
new file mode 100644
index 000000000..cc8ca720e
--- /dev/null
+++ b/tests/Jellyfin.Server.Implementations.Tests/Playlists/PlaylistManagerTests.cs
@@ -0,0 +1,40 @@
+using Emby.Server.Implementations.Playlists;
+using Xunit;
+
+namespace Jellyfin.Server.Implementations.Tests.Playlists;
+
+public class PlaylistManagerTests
+{
+ [Fact]
+ public void DetermineAdjustedIndexMoveToFirstPositionNoPriorInAllList()
+ {
+ var priorIndexAllChildren = 0;
+ var newIndex = 0;
+
+ var adjustedIndex = PlaylistManager.DetermineAdjustedIndex(priorIndexAllChildren, newIndex);
+
+ Assert.Equal(0, adjustedIndex);
+ }
+
+ [Fact]
+ public void DetermineAdjustedIndexPriorInMiddleOfAllList()
+ {
+ var priorIndexAllChildren = 2;
+ var newIndex = 0;
+
+ var adjustedIndex = PlaylistManager.DetermineAdjustedIndex(priorIndexAllChildren, newIndex);
+
+ Assert.Equal(1, adjustedIndex);
+ }
+
+ [Fact]
+ public void DetermineAdjustedIndexMoveMiddleOfPlaylist()
+ {
+ var priorIndexAllChildren = 2;
+ var newIndex = 1;
+
+ var adjustedIndex = PlaylistManager.DetermineAdjustedIndex(priorIndexAllChildren, newIndex);
+
+ Assert.Equal(3, adjustedIndex);
+ }
+}