< Summary

Information
Class: DirectSight.Common.LinqExtensions
Assembly DirectSight
File(s): /home/runner/work/DirectSight/DirectSight/DirectSight/Common/LinqExtensions.cs
Line coverage
63%
Covered lines: 7
Uncovered lines: 4
Coverable lines: 11
Total lines: 38
Line coverage: 63.6%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
HasAttributeWithValue(...)50%4463.63%

File(s)

/home/runner/work/DirectSight/DirectSight/DirectSight/Common/LinqExtensions.cs

#LineLine coverage
 1using System;
 2using System.Xml.Linq;
 3
 4namespace DirectSight.Common;
 5
 6/// <summary>
 7/// Linq extensions.
 8/// </summary>
 9internal static class LinqExtensions
 10{
 11    /// <summary>
 12    /// Determines whether a <see cref="XElement"/> has an <see cref="XAttribute"/> with the given value..
 13    /// </summary>
 14    /// <param name="element">The <see cref="XElement"/>.</param>
 15    /// <param name="attributeName">The name of the attribute.</param>
 16    /// <param name="attributeValue">The attribute value.</param>
 17    /// <returns>
 18    ///   <c>true</c> if <see cref="XElement"/> has an <see cref="XAttribute"/> with the given value; otherwise, <c>fals
 19    /// </returns>
 20    internal static bool HasAttributeWithValue(this XElement element, XName attributeName, string attributeValue)
 1652621    {
 1652622        if (element == null)
 023        {
 024            throw new ArgumentNullException(nameof(element));
 25        }
 26
 1652627        XAttribute attribute = element.Attribute(attributeName);
 28
 1652629        if (attribute == null)
 030        {
 031            return false;
 32        }
 33        else
 1652634        {
 1652635            return string.Equals(attribute.Value, attributeValue, StringComparison.OrdinalIgnoreCase);
 36        }
 1652637    }
 38}