< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.UriGenerator
Assembly: CoreWCF.NetFramingBase
File(s): /home/runner/work/CoreWCF/CoreWCF/src/Common/src/DuplexChannels/CoreWCF/Channels/UriGenerator.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 46
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%110%
.ctor(...)100%110%
.ctor(...)0%440%
Next()100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/Common/src/DuplexChannels/CoreWCF/Channels/UriGenerator.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.Channels
 9{
 10    internal class UriGenerator
 11    {
 12        private long _id;
 13        private readonly string _prefix;
 14
 15        public UriGenerator()
 016            : this("uuid")
 17        {
 018        }
 19
 20        public UriGenerator(string scheme)
 021            : this(scheme, ";")
 22        {
 023        }
 24
 025        public UriGenerator(string scheme, string delimiter)
 26        {
 027            if (scheme == null)
 28            {
 029                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(scheme)));
 30            }
 31
 032            if (scheme.Length == 0)
 33            {
 034                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.UriGeneratorSchemeMus
 35            }
 36
 037            _prefix = string.Concat(scheme, ":", Guid.NewGuid().ToString(), delimiter, "id=");
 038        }
 39
 40        public string Next()
 41        {
 042            long nextId = Interlocked.Increment(ref _id);
 043            return _prefix + nextId.ToString(CultureInfo.InvariantCulture);
 44        }
 45    }
 46}