< Summary

Class:Microsoft.Azure.ServiceBus.Primitives.ServiceBusUriHelper
Assembly:Microsoft.Azure.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Microsoft.Azure.ServiceBus\src\Primitives\ServiceBusUriHelper.cs
Covered lines:0
Uncovered lines:16
Coverable lines:16
Total lines:42
Line coverage:0% (0 of 16)
Covered branches:0
Total branches:8
Branch coverage:0% (0 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
NormalizeUri(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\servicebus\Microsoft.Azure.ServiceBus\src\Primitives\ServiceBusUriHelper.cs

#LineLine coverage
 1// Copyright (c) Microsoft. All rights reserved.
 2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
 3
 4namespace Microsoft.Azure.ServiceBus.Primitives
 5{
 6    using System;
 7
 8    static class ServiceBusUriHelper
 9    {
 10        internal static string NormalizeUri(string uri, string scheme, bool stripQueryParameters = true, bool stripPath 
 11        {
 012            var uriBuilder = new UriBuilder(uri)
 013            {
 014                Scheme = scheme,
 015                Port = -1,
 016                Fragment = string.Empty,
 017                Password = string.Empty,
 018                UserName = string.Empty,
 019            };
 20
 021            if (stripPath)
 22            {
 023                uriBuilder.Path = string.Empty;
 24            }
 25
 026            if (stripQueryParameters)
 27            {
 028                uriBuilder.Query = string.Empty;
 29            }
 30
 031            if (ensureTrailingSlash)
 32            {
 033                if (!uriBuilder.Path.EndsWith("/", StringComparison.Ordinal))
 34                {
 035                    uriBuilder.Path += "/";
 36                }
 37            }
 38
 039            return uriBuilder.Uri.AbsoluteUri;
 40        }
 41    }
 42}

Methods/Properties

NormalizeUri(...)