< Summary - CoreWCF Coverage — PR #1766

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

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

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    {
 012        private static long s_nextId = 0;
 013        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
 018        private SecurityUniqueId(string prefix, long id)
 19        {
 020            _id = id;
 021            _prefix = prefix;
 022            _val = null;
 023        }
 24
 25        public static SecurityUniqueId Create()
 26        {
 027            return Create(s_commonPrefix);
 28        }
 29
 30        public static SecurityUniqueId Create(string prefix)
 31        {
 032            return new SecurityUniqueId(prefix, Interlocked.Increment(ref s_nextId));
 33        }
 34
 35        public string Value
 36        {
 37            get
 38            {
 039                if (_val == null)
 40                {
 041                    _val = _prefix + _id.ToString(CultureInfo.InvariantCulture);
 42                }
 43
 044                return _val;
 45            }
 46        }
 47    }
 48}