< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.SecurityUniqueId
Assembly: CoreWCF.UnixDomainSocket
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    {
 112        private static long s_nextId = 0;
 113        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
 118        private SecurityUniqueId(string prefix, long id)
 19        {
 120            _id = id;
 121            _prefix = prefix;
 122            _val = null;
 123        }
 24
 25        public static SecurityUniqueId Create()
 26        {
 127            return Create(s_commonPrefix);
 28        }
 29
 30        public static SecurityUniqueId Create(string prefix)
 31        {
 132            return new SecurityUniqueId(prefix, Interlocked.Increment(ref s_nextId));
 33        }
 34
 35        public string Value
 36        {
 37            get
 38            {
 139                if (_val == null)
 40                {
 141                    _val = _prefix + _id.ToString(CultureInfo.InvariantCulture);
 42                }
 43
 144                return _val;
 45            }
 46        }
 47    }
 48}