• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

loresoft / DotNet.Property / 6719270641

01 Nov 2023 11:49AM UTC coverage: 55.357%. Remained the same
6719270641

Pull #93

github

web-flow
Merge 57dc32590 into b83870101
Pull Request #93: Bump xunit from 2.5.0 to 2.6.0

28 of 50 branches covered (0.0%)

Branch coverage included in aggregate %.

65 of 118 relevant lines covered (55.08%)

3.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/DotNet.Property/Extensions.cs
1
using System;
2
using System.Xml.Linq;
3

4
namespace DotNet.Property
5
{
6
    /// <summary>
7
    /// Extension methods
8
    /// </summary>
9
    public static class Extensions
10
    {
11
        /// <summary>
12
        /// Gets the or create an <see cref="XElement"/>.
13
        /// </summary>
14
        /// <param name="container">The container.</param>
15
        /// <param name="name">The name of the element.</param>
16
        /// <returns></returns>
17
        /// <exception cref="ArgumentNullException"><paramref name="container"/> or <paramref name="name"/> is <see langword="null"/></exception>
18
        public static XElement GetOrCreateElement(this XContainer container, string name)
19
        {
20
            if (container == null)
11!
21
                throw new ArgumentNullException(nameof(container));
×
22
            if (name == null)
11!
23
                throw new ArgumentNullException(nameof(name));
×
24

25
            var element = container.Element(name);
11✔
26
            if (element != null)
11✔
27
                return element;
3✔
28

29
            element = new XElement(name);
8✔
30
            container.Add(element);
8✔
31

32
            return element;
8✔
33
        }
34
    }
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc