< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Sorting.IsFolderComparer
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Sorting/IsFolderComparer.cs
Line coverage
33%
Covered lines: 1
Uncovered lines: 2
Coverable lines: 3
Total lines: 39
Line coverage: 33.3%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Type()100%11100%
Compare(...)100%210%
GetValue(...)0%620%

File(s)

/srv/git/jellyfin/Emby.Server.Implementations/Sorting/IsFolderComparer.cs

#LineLine coverage
 1#pragma warning disable CS1591
 2
 3using Jellyfin.Data.Enums;
 4using MediaBrowser.Controller.Entities;
 5using MediaBrowser.Controller.Sorting;
 6using MediaBrowser.Model.Querying;
 7
 8namespace Emby.Server.Implementations.Sorting
 9{
 10    public class IsFolderComparer : IBaseItemComparer
 11    {
 12        /// <summary>
 13        /// Gets the name.
 14        /// </summary>
 15        /// <value>The name.</value>
 116        public ItemSortBy Type => ItemSortBy.IsFolder;
 17
 18        /// <summary>
 19        /// Compares the specified x.
 20        /// </summary>
 21        /// <param name="x">The x.</param>
 22        /// <param name="y">The y.</param>
 23        /// <returns>System.Int32.</returns>
 24        public int Compare(BaseItem? x, BaseItem? y)
 25        {
 026            return GetValue(x).CompareTo(GetValue(y));
 27        }
 28
 29        /// <summary>
 30        /// Gets the value.
 31        /// </summary>
 32        /// <param name="x">The x.</param>
 33        /// <returns>System.String.</returns>
 34        private static int GetValue(BaseItem? x)
 35        {
 036            return x?.IsFolder ?? true ? 0 : 1;
 37        }
 38    }
 39}