< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.UriGenerator
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Channels/UriGenerator.cs
Line coverage
53%
Covered lines: 7
Uncovered lines: 6
Coverable lines: 13
Total lines: 42
Line coverage: 53.8%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
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(...)50%4471.42%
Next()100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/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 string _prefix;
 14
 15        public UriGenerator()
 016            : this("uuid")
 17        {
 018        }
 19
 20        public UriGenerator(string scheme)
 021            : this(scheme, ";")
 22        {
 023        }
 24
 125        public UriGenerator(string scheme, string delimiter)
 26        {
 127            if (scheme == null)
 028                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(scheme)));
 29
 130            if (scheme.Length == 0)
 031                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.UriGeneratorSchemeMus
 32
 133            _prefix = string.Concat(scheme, ":", Guid.NewGuid().ToString(), delimiter, "id=");
 134        }
 35
 36        public string Next()
 37        {
 2938            long nextId = Interlocked.Increment(ref _id);
 2939            return _prefix + nextId.ToString(CultureInfo.InvariantCulture);
 40        }
 41    }
 42}