< Summary

Class:Azure.Storage.Files.DataLake.Models.DataLakeRequestConditions
Assembly:Azure.Storage.Files.DataLake
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.DataLake\src\Models\DataLakeRequestConditions.cs
Covered lines:1
Uncovered lines:18
Coverable lines:19
Total lines:75
Line coverage:5.2% (1 of 19)
Covered branches:0
Total branches:12
Branch coverage:0% (0 of 12)

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.Files.DataLake\src\Models\DataLakeRequestConditions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Text;
 5
 6namespace Azure.Storage.Files.DataLake.Models
 7{
 8    /// <summary>
 9    /// Specifies lease access conditions for a file system or path.
 10    /// </summary>
 11    public class DataLakeRequestConditions : RequestConditions
 12    {
 13        /// <summary>
 14        /// Optionally limit requests to resources with an active lease
 15        /// matching this Id.
 16        /// </summary>
 354217        public string LeaseId { get; set; }
 18
 19        /// <summary>
 20        /// Converts the value of the current RequestConditions object to
 21        /// its equivalent string representation.
 22        /// </summary>
 23        /// <returns>
 24        /// A string representation of the RequestConditions.
 25        /// </returns>
 26        public override string ToString()
 27        {
 028            StringBuilder conditions = new StringBuilder();
 029            conditions.Append('[').Append(GetType().Name);
 030            AddConditions(conditions);
 031            if (conditions[conditions.Length - 1] == ';')
 32            {
 033                conditions[conditions.Length - 1] = ']';
 34            }
 35            else
 36            {
 037                conditions.Append(']');
 38            }
 039            return conditions.ToString();
 40        }
 41
 42        /// <summary>
 43        /// Collect any request conditions.  Conditions should be separated by
 44        /// a semicolon.
 45        /// </summary>
 46        /// <param name="conditions">The collected conditions.</param>
 47        internal virtual void AddConditions(StringBuilder conditions)
 48        {
 049            if (IfMatch != null)
 50            {
 051                conditions.Append(nameof(IfMatch)).Append('=').Append(IfMatch).Append(';');
 52            }
 53
 054            if (IfNoneMatch != null)
 55            {
 056                conditions.Append(nameof(IfNoneMatch)).Append('=').Append(IfNoneMatch).Append(';');
 57            }
 58
 059            if (IfModifiedSince != null)
 60            {
 061                conditions.Append(nameof(IfModifiedSince)).Append('=').Append(IfModifiedSince).Append(';');
 62            }
 63
 064            if (IfUnmodifiedSince != null)
 65            {
 066                conditions.Append(nameof(IfUnmodifiedSince)).Append('=').Append(IfUnmodifiedSince).Append(';');
 67            }
 68
 069            if (LeaseId != null)
 70            {
 071                conditions.Append(nameof(LeaseId)).Append('=').Append(LeaseId).Append(';');
 72            }
 073        }
 74    }
 75}