< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Sorting.AlbumComparer
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Sorting/AlbumComparer.cs
Line coverage
33%
Covered lines: 1
Uncovered lines: 2
Coverable lines: 3
Total lines: 42
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/AlbumComparer.cs

#LineLine coverage
 1using System;
 2using Jellyfin.Data.Enums;
 3using MediaBrowser.Controller.Entities;
 4using MediaBrowser.Controller.Entities.Audio;
 5using MediaBrowser.Controller.Sorting;
 6using MediaBrowser.Model.Querying;
 7
 8namespace Emby.Server.Implementations.Sorting
 9{
 10    /// <summary>
 11    /// Class AlbumComparer.
 12    /// </summary>
 13    public class AlbumComparer : IBaseItemComparer
 14    {
 15        /// <summary>
 16        /// Gets the name.
 17        /// </summary>
 18        /// <value>The name.</value>
 119        public ItemSortBy Type => ItemSortBy.Album;
 20
 21        /// <summary>
 22        /// Compares the specified x.
 23        /// </summary>
 24        /// <param name="x">The x.</param>
 25        /// <param name="y">The y.</param>
 26        /// <returns>System.Int32.</returns>
 27        public int Compare(BaseItem? x, BaseItem? y)
 28        {
 029            return string.Compare(GetValue(x), GetValue(y), StringComparison.OrdinalIgnoreCase);
 30        }
 31
 32        /// <summary>
 33        /// Gets the value.
 34        /// </summary>
 35        /// <param name="x">The x.</param>
 36        /// <returns>System.String.</returns>
 37        private static string GetValue(BaseItem? x)
 38        {
 039            return x is Audio audio ? audio.Album : string.Empty;
 40        }
 41    }
 42}