< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.SecurityUniqueId
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/Common/src/CoreWCF/IdentityModel/SecurityUniqueId.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 48
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.cctor()100%11100%
.ctor(...)100%11100%
Create()100%11100%
Create(...)100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/Common/src/CoreWCF/IdentityModel/SecurityUniqueId.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System;
 5using System.Globalization;
 6using System.Threading;
 7
 8namespace CoreWCF.IdentityModel
 9{
 10    internal class SecurityUniqueId
 11    {
 412        private static long s_nextId = 0;
 413        private static readonly string s_commonPrefix = "uuid-" + Guid.NewGuid().ToString() + "-";
 14        private readonly long _id;
 15        private readonly string _prefix;
 16        private string _val;
 17
 6418        private SecurityUniqueId(string prefix, long id)
 19        {
 6420            _id = id;
 6421            _prefix = prefix;
 6422            _val = null;
 6423        }
 24
 25        public static SecurityUniqueId Create()
 26        {
 6427            return Create(s_commonPrefix);
 28        }
 29
 30        public static SecurityUniqueId Create(string prefix)
 31        {
 6432            return new SecurityUniqueId(prefix, Interlocked.Increment(ref s_nextId));
 33        }
 34
 35        public string Value
 36        {
 37            get
 38            {
 6439                if (_val == null)
 40                {
 6441                    _val = _prefix + _id.ToString(CultureInfo.InvariantCulture);
 42                }
 43
 6444                return _val;
 45            }
 46        }
 47    }
 48}