< Summary

Class:Azure.Data.Tables.Sas.TableSasQueryParameters
Assembly:Azure.Data.Tables
File(s):C:\Git\azure-sdk-for-net\sdk\tables\Azure.Data.Tables\src\Sas\TableSasQueryParameters.cs
Covered lines:30
Uncovered lines:9
Coverable lines:39
Total lines:132
Line coverage:76.9% (30 of 39)
Covered branches:4
Total branches:8
Branch coverage:50% (4 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_TableName()-100%100%
get_StartPartitionKey()-100%100%
get_StartRowKey()-100%100%
get_EndPartitionKey()-100%100%
get_EndRowKey()-100%100%
get_Empty()-0%100%
.ctor()-0%100%
.ctor(...)-100%100%
.ctor(...)-0%100%
ToString()-66.67%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\tables\Azure.Data.Tables\src\Sas\TableSasQueryParameters.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Globalization;
 7using System.Linq;
 8using System.Text;
 9
 10namespace Azure.Data.Tables.Sas
 11{
 12    /// <summary>
 13    /// A <see cref="TableSasQueryParameters"/> object represents the components
 14    /// that make up an Azure Storage Shared Access Signature's query
 15    /// parameters.  You can construct a new instance using
 16    /// <see cref="TableSasBuilder"/>.
 17    ///
 18    /// For more information, <see href="https://docs.microsoft.com/rest/api/storageservices/create-service-sas">Create 
 19    /// </summary>
 20    public sealed class TableSasQueryParameters : TableAccountSasQueryParameters
 21    {
 1622        internal string TableName { get; set; }
 23
 24        /// <summary>
 25        /// The start of PartionKey range.
 26        /// </summary>
 1627        public string StartPartitionKey { get; set; }
 28
 29        /// <summary>
 30        /// The end of PartionKey range.
 31        /// </summary>
 1632        public string StartRowKey { get; set; }
 33
 34        /// <summary>
 35        /// The start of RowKey range.
 36        /// </summary>
 1637        public string EndPartitionKey { get; set; }
 38
 39        /// <summary>
 40        /// The end of RowKey range.
 41        /// </summary>
 1642        public string EndRowKey { get; set; }
 43
 44
 045        public static TableSasQueryParameters Empty => new TableSasQueryParameters();
 46
 47        internal TableSasQueryParameters()
 048            : base()
 49        {
 050        }
 51
 52        /// <summary>
 53        /// Creates a new TableSasQueryParameters instance.
 54        /// </summary>
 55        internal TableSasQueryParameters(
 56            string version,
 57            TableAccountSasResourceTypes? resourceTypes,
 58            string tableName,
 59            string partitionKeyStart,
 60            string rowKeyStart,
 61            string partitionKeyEnd,
 62            string rowKeyEnd,
 63            TableSasProtocol protocol,
 64            DateTimeOffset startsOn,
 65            DateTimeOffset expiresOn,
 66            TableSasIPRange ipRange,
 67            string identifier,
 68            string resource,
 69            string permissions,
 70            string signature)
 871            : base(
 872                version,
 873                resourceTypes,
 874                protocol,
 875                startsOn,
 876                expiresOn,
 877                ipRange,
 878                identifier,
 879                resource,
 880                permissions,
 881                signature)
 82        {
 883            TableName = tableName;
 884            StartPartitionKey = partitionKeyStart;
 885            EndPartitionKey = partitionKeyEnd;
 886            StartRowKey = rowKeyStart;
 887            EndRowKey = rowKeyEnd;
 888        }
 89
 90        /// <summary>
 91        /// Creates a new instance of the <see cref="TableSasQueryParameters"/>
 92        /// type based on the supplied query parameters <paramref name="values"/>.
 93        /// All SAS-related query parameters will be removed from
 94        /// <paramref name="values"/>.
 95        /// </summary>
 96        /// <param name="values">URI query parameters</param>
 97        internal TableSasQueryParameters(
 98            IDictionary<string, string> values)
 099            : base(values)
 0100        {}
 101
 102        /// <summary>
 103        /// Convert the SAS query parameters into a URL encoded query string.
 104        /// </summary>
 105        /// <returns>
 106        /// A URL encoded query string representing the SAS.
 107        /// </returns>
 108        public override string ToString()
 109        {
 8110            StringBuilder sb = new StringBuilder();
 8111            sb.AppendQueryParameter(TableConstants.Sas.Parameters.TableName, TableName);
 8112            if (!string.IsNullOrWhiteSpace(StartPartitionKey))
 113            {
 0114                sb.AppendQueryParameter(TableConstants.Sas.Parameters.StartPartitionKey, StartPartitionKey);
 115            }
 8116            if (!string.IsNullOrWhiteSpace(EndPartitionKey))
 117            {
 0118                sb.AppendQueryParameter(TableConstants.Sas.Parameters.EndPartitionKey, EndPartitionKey);
 119            }
 8120            if (!string.IsNullOrWhiteSpace(StartRowKey))
 121            {
 0122                sb.AppendQueryParameter(TableConstants.Sas.Parameters.StartRowKey, StartRowKey);
 123            }
 8124            if (!string.IsNullOrWhiteSpace(EndRowKey))
 125            {
 0126                sb.AppendQueryParameter(TableConstants.Sas.Parameters.EndRowKey, EndRowKey);
 127            }
 8128            this.AppendProperties(sb);
 8129            return sb.ToString();
 130        }
 131    }
 132}