< Summary

Class:Azure.Messaging.ServiceBus.Primitives.StringUtility
Assembly:Azure.Messaging.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Primitives\StringUtility.cs
Covered lines:0
Uncovered lines:11
Coverable lines:11
Total lines:59
Line coverage:0% (0 of 11)
Covered branches:0
Total branches:4
Branch coverage:0% (0 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
GetFormattedLockTokens(...)-0%0%
GetFormattedSequenceNumbers(...)-0%0%
FormatForUser(...)-0%100%
FormatInvariant(...)-0%100%
FormatInvariant(...)-0%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using System.Globalization;
 6using System.Text;
 7
 8namespace Azure.Messaging.ServiceBus.Primitives
 9{
 10    internal static class StringUtility
 11    {
 12
 13        public static string GetFormattedLockTokens(IEnumerable<string> lockTokens)
 14        {
 015            var lockTokenBuilder = new StringBuilder();
 016            foreach (var lockToken in lockTokens)
 17            {
 018                lockTokenBuilder.AppendFormat(CultureInfo.InvariantCulture, "<LockToken>{0}</LockToken>", lockToken);
 19            }
 20
 021            return lockTokenBuilder.ToString();
 22        }
 23
 24        public static string GetFormattedSequenceNumbers(IEnumerable<long> sequenceNumbers)
 25        {
 026            var sequenceNumberBuilder = new StringBuilder();
 027            foreach (var sequenceNumber in sequenceNumbers)
 28            {
 029                sequenceNumberBuilder.AppendFormat(CultureInfo.InvariantCulture, "<SequenceNumber>{0}</SequenceNumber>",
 30            }
 31
 032            return sequenceNumberBuilder.ToString();
 33        }
 34
 35        /// <summary>
 36        /// Formats a string+parameters using CurrentCulture.
 37        /// </summary>
 38        public static string FormatForUser(this string format, params object[] args)
 39        {
 040            return string.Format(CultureInfo.CurrentCulture, format, args);
 41        }
 42
 43        /// <summary>
 44        /// Formats a string+parameter using InvariantCulture.  This overload avoids allocating an array when there's on
 45        /// </summary>
 46        public static string FormatInvariant(this string format, object arg0)
 47        {
 048            return string.Format(CultureInfo.InvariantCulture, format, arg0);
 49        }
 50
 51        /// <summary>
 52        /// Formats a string+parameters using InvariantCulture.
 53        /// </summary>
 54        public static string FormatInvariant(this string format, params object[] args)
 55        {
 056            return string.Format(CultureInfo.InvariantCulture, format, args);
 57        }
 58    }
 59}