< Summary

Class:Microsoft.Azure.EventHubs.Processor.AzureBlobLease
Assembly:Microsoft.Azure.EventHubs.Processor
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Microsoft.Azure.EventHubs.Processor\src\AzureBlobLease.cs
Covered lines:0
Uncovered lines:25
Coverable lines:25
Total lines:59
Line coverage:0% (0 of 25)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
.ctor(...)-0%100%
.ctor(...)-0%100%
.ctor(...)-0%100%
get_Blob()-0%100%
IsExpired()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Microsoft.Azure.EventHubs.Processor\src\AzureBlobLease.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.EventHubs.Processor
 5{
 6  using System;
 7  using System.Threading.Tasks;
 8  using Microsoft.Azure.Storage.Blob;
 9  using Newtonsoft.Json;
 10
 11  class AzureBlobLease : Lease
 12  {
 13        readonly bool isOwned;
 14
 15      // ctor needed for deserialization
 016      internal AzureBlobLease()
 17    {
 018    }
 19
 020      internal AzureBlobLease(string partitionId, CloudBlockBlob blob) : base(partitionId)
 21    {
 022      this.Blob = blob;
 023            this.isOwned = blob.Properties.LeaseState == LeaseState.Leased;
 024        }
 25
 026        internal AzureBlobLease(string partitionId, string owner, CloudBlockBlob blob) : base(partitionId)
 27        {
 028            this.Blob = blob;
 029            this.Owner = owner;
 030            this.isOwned = blob.Properties.LeaseState == LeaseState.Leased;
 031        }
 32
 33        internal AzureBlobLease(AzureBlobLease source)
 034      : base(source)
 35    {
 036      this.Offset = source.Offset;
 037      this.SequenceNumber = source.SequenceNumber;
 038      this.Blob = source.Blob;
 039            this.isOwned = source.isOwned;
 040    }
 41
 042      internal AzureBlobLease(AzureBlobLease source, CloudBlockBlob blob) : base(source)
 43    {
 044      this.Offset = source.Offset;
 045      this.SequenceNumber = source.SequenceNumber;
 046      this.Blob = blob;
 047            this.isOwned = blob.Properties.LeaseState == LeaseState.Leased;
 048    }
 49
 50      // do not serialize
 51      [JsonIgnore]
 052    public CloudBlockBlob Blob { get; }
 53
 54      public override Task<bool> IsExpired()
 55    {
 056            return Task.FromResult(!this.isOwned);
 57    }
 58  }
 59}