< Summary - Jellyfin

Information
Class: Jellyfin.Data.Entities.Preference
Assembly: Jellyfin.Data
File(s): /srv/git/jellyfin/Jellyfin.Data/Entities/Preference.cs
Line coverage
60%
Covered lines: 3
Uncovered lines: 2
Coverable lines: 5
Total lines: 68
Line coverage: 60%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
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(...)50%22100%
OnSavingChanges()100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Data/Entities/Preference.cs

#LineLine coverage
 1using System;
 2using System.ComponentModel.DataAnnotations;
 3using System.ComponentModel.DataAnnotations.Schema;
 4using Jellyfin.Data.Enums;
 5using Jellyfin.Data.Interfaces;
 6
 7namespace Jellyfin.Data.Entities
 8{
 9    /// <summary>
 10    /// An entity representing a preference attached to a user or group.
 11    /// </summary>
 12    public class Preference : IHasConcurrencyToken
 13    {
 14        /// <summary>
 15        /// Initializes a new instance of the <see cref="Preference"/> class.
 16        /// Public constructor with required data.
 17        /// </summary>
 18        /// <param name="kind">The preference kind.</param>
 19        /// <param name="value">The value.</param>
 20        public Preference(PreferenceKind kind, string value)
 21        {
 50722            Kind = kind;
 50723            Value = value ?? throw new ArgumentNullException(nameof(value));
 50724        }
 25
 26        /// <summary>
 27        /// Gets the id of this preference.
 28        /// </summary>
 29        /// <remarks>
 30        /// Identity, Indexed, Required.
 31        /// </remarks>
 32        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 33        public int Id { get; private set; }
 34
 35        /// <summary>
 36        /// Gets or sets the id of the associated user.
 37        /// </summary>
 38        public Guid? UserId { get; set; }
 39
 40        /// <summary>
 41        /// Gets the type of this preference.
 42        /// </summary>
 43        /// <remarks>
 44        /// Required.
 45        /// </remarks>
 46        public PreferenceKind Kind { get; private set; }
 47
 48        /// <summary>
 49        /// Gets or sets the value of this preference.
 50        /// </summary>
 51        /// <remarks>
 52        /// Required, Max length = 65535.
 53        /// </remarks>
 54        [MaxLength(65535)]
 55        [StringLength(65535)]
 56        public string Value { get; set; }
 57
 58        /// <inheritdoc/>
 59        [ConcurrencyCheck]
 60        public uint RowVersion { get; private set; }
 61
 62        /// <inheritdoc/>
 63        public void OnSavingChanges()
 64        {
 065            RowVersion++;
 066        }
 67    }
 68}