< Summary - Jellyfin

Information
Class: MediaBrowser.Model.Dlna.ContainerProfile
Assembly: MediaBrowser.Model
File(s): /srv/git/jellyfin/MediaBrowser.Model/Dlna/ContainerProfile.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 49
Line coverage: 100%
Branch coverage
50%
Covered branches: 2
Total branches: 4
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
ContainsContainer(...)50%44100%

File(s)

/srv/git/jellyfin/MediaBrowser.Model/Dlna/ContainerProfile.cs

#LineLine coverage
 1#pragma warning disable CA1819 // Properties should not return arrays
 2
 3using System;
 4using System.Collections.Generic;
 5using System.Xml.Serialization;
 6using MediaBrowser.Model.Extensions;
 7
 8namespace MediaBrowser.Model.Dlna;
 9
 10/// <summary>
 11/// Defines the <see cref="ContainerProfile"/>.
 12/// </summary>
 13public class ContainerProfile
 14{
 15    /// <summary>
 16    /// Gets or sets the <see cref="DlnaProfileType"/> which this container must meet.
 17    /// </summary>
 18    [XmlAttribute("type")]
 19    public DlnaProfileType Type { get; set; }
 20
 21    /// <summary>
 22    /// Gets or sets the list of <see cref="ProfileCondition"/> which this container will be applied to.
 23    /// </summary>
 24    public ProfileCondition[] Conditions { get; set; } = [];
 25
 26    /// <summary>
 27    /// Gets or sets the container(s) which this container must meet.
 28    /// </summary>
 29    [XmlAttribute("container")]
 30    public string? Container { get; set; }
 31
 32    /// <summary>
 33    /// Gets or sets the sub container(s) which this container must meet.
 34    /// </summary>
 35    [XmlAttribute("subcontainer")]
 36    public string? SubContainer { get; set; }
 37
 38    /// <summary>
 39    /// Returns true if an item in <paramref name="container"/> appears in the <see cref="Container"/> property.
 40    /// </summary>
 41    /// <param name="container">The item to match.</param>
 42    /// <param name="useSubContainer">Consider subcontainers.</param>
 43    /// <returns>The result of the operation.</returns>
 44    public bool ContainsContainer(ReadOnlySpan<char> container, bool useSubContainer = false)
 45    {
 5246        var containerToCheck = useSubContainer && string.Equals(Container, "hls", StringComparison.OrdinalIgnoreCase) ? 
 5247        return ContainerHelper.ContainsContainer(containerToCheck, container);
 48    }
 49}