< Summary - Jellyfin

Information
Class: Emby.Naming.AudioBook.AudioBookFileInfo
Assembly: Emby.Naming
File(s): /srv/git/jellyfin/Emby.Naming/AudioBook/AudioBookFileInfo.cs
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 77
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
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
.ctor(...)100%11100%
CompareTo(...)100%88100%

File(s)

/srv/git/jellyfin/Emby.Naming/AudioBook/AudioBookFileInfo.cs

#LineLine coverage
 1using System;
 2
 3namespace Emby.Naming.AudioBook
 4{
 5    /// <summary>
 6    /// Represents a single video file.
 7    /// </summary>
 8    public class AudioBookFileInfo : IComparable<AudioBookFileInfo>
 9    {
 10        /// <summary>
 11        /// Initializes a new instance of the <see cref="AudioBookFileInfo"/> class.
 12        /// </summary>
 13        /// <param name="path">Path to audiobook file.</param>
 14        /// <param name="container">File type.</param>
 15        /// <param name="partNumber">Number of part this file represents.</param>
 16        /// <param name="chapterNumber">Number of chapter this file represents.</param>
 17        public AudioBookFileInfo(string path, string container, int? partNumber = default, int? chapterNumber = default)
 18        {
 12719            Path = path;
 12720            Container = container;
 12721            PartNumber = partNumber;
 12722            ChapterNumber = chapterNumber;
 12723        }
 24
 25        /// <summary>
 26        /// Gets or sets the path.
 27        /// </summary>
 28        /// <value>The path.</value>
 29        public string Path { get; set; }
 30
 31        /// <summary>
 32        /// Gets or sets the container.
 33        /// </summary>
 34        /// <value>The container.</value>
 35        public string Container { get; set; }
 36
 37        /// <summary>
 38        /// Gets or sets the part number.
 39        /// </summary>
 40        /// <value>The part number.</value>
 41        public int? PartNumber { get; set; }
 42
 43        /// <summary>
 44        /// Gets or sets the chapter number.
 45        /// </summary>
 46        /// <value>The chapter number.</value>
 47        public int? ChapterNumber { get; set; }
 48
 49        /// <inheritdoc />
 50        public int CompareTo(AudioBookFileInfo? other)
 51        {
 2852            if (ReferenceEquals(this, other))
 53            {
 154                return 0;
 55            }
 56
 2757            if (ReferenceEquals(null, other))
 58            {
 159                return 1;
 60            }
 61
 2662            var chapterNumberComparison = Nullable.Compare(ChapterNumber, other.ChapterNumber);
 2663            if (chapterNumberComparison != 0)
 64            {
 765                return chapterNumberComparison;
 66            }
 67
 1968            var partNumberComparison = Nullable.Compare(PartNumber, other.PartNumber);
 1969            if (partNumberComparison != 0)
 70            {
 771                return partNumberComparison;
 72            }
 73
 1274            return string.Compare(Path, other.Path, StringComparison.Ordinal);
 75        }
 76    }
 77}