< Summary

Class:Azure.Storage.Blobs.Models.BlobRequestConditions
Assembly:Azure.Storage.Blobs
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Blobs\src\Models\BlobRequestConditions.cs
Covered lines:1
Uncovered lines:20
Coverable lines:21
Total lines:82
Line coverage:4.7% (1 of 21)
Covered branches:0
Total branches:14
Branch coverage:0% (0 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_LeaseId()-100%100%
ToString()-0%0%
AddConditions(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Blobs\src\Models\BlobRequestConditions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Text;
 6using Azure.Storage.Blobs.Models;
 7
 8namespace Azure.Storage.Blobs.Models
 9{
 10    /// <summary>
 11    /// Specifies blob lease access conditions for a container or blob.
 12    /// </summary>
 13    public class BlobRequestConditions : BlobLeaseRequestConditions
 14    {
 15        /// <summary>
 16        /// Optionally limit requests to resources with an active lease
 17        /// matching this Id.
 18        /// </summary>
 511619        public string LeaseId { get; set; }
 20
 21        /// <summary>
 22        /// Converts the value of the current RequestConditions object to
 23        /// its equivalent string representation.
 24        /// </summary>
 25        /// <returns>
 26        /// A string representation of the RequestConditions.
 27        /// </returns>
 28        public override string ToString()
 29        {
 030            StringBuilder conditions = new StringBuilder();
 031            conditions.Append('[').Append(GetType().Name);
 032            AddConditions(conditions);
 033            if (conditions[conditions.Length - 1] == ';')
 34            {
 035                conditions[conditions.Length - 1] = ']';
 36            }
 37            else
 38            {
 039                conditions.Append(']');
 40            }
 041            return conditions.ToString();
 42        }
 43
 44        /// <summary>
 45        /// Collect any request conditions.  Conditions should be separated by
 46        /// a semicolon.
 47        /// </summary>
 48        /// <param name="conditions">The collected conditions.</param>
 49        internal virtual void AddConditions(StringBuilder conditions)
 50        {
 051            if (IfMatch != null)
 52            {
 053                conditions.Append(nameof(IfMatch)).Append('=').Append(IfMatch).Append(';');
 54            }
 55
 056            if (IfNoneMatch != null)
 57            {
 058                conditions.Append(nameof(IfNoneMatch)).Append('=').Append(IfNoneMatch).Append(';');
 59            }
 60
 061            if (IfModifiedSince != null)
 62            {
 063                conditions.Append(nameof(IfModifiedSince)).Append('=').Append(IfModifiedSince).Append(';');
 64            }
 65
 066            if (IfUnmodifiedSince != null)
 67            {
 068                conditions.Append(nameof(IfUnmodifiedSince)).Append('=').Append(IfUnmodifiedSince).Append(';');
 69            }
 70
 071            if (LeaseId != null)
 72            {
 073                conditions.Append(nameof(LeaseId)).Append('=').Append(LeaseId).Append(';');
 74            }
 75
 076            if (TagConditions != null)
 77            {
 078                conditions.Append(nameof(TagConditions)).Append('=').Append(TagConditions).Append(';');
 79            }
 080        }
 81    }
 82}