< Summary

Class:Microsoft.Azure.EventHubs.ServiceFabricProcessor.ServiceFabricPartitionLister
Assembly:Microsoft.Azure.EventHubs.ServiceFabricProcessor
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Microsoft.Azure.EventHubs.ServiceFabricProcessor\src\ServiceFabricPartitionLister.cs
Covered lines:0
Uncovered lines:11
Coverable lines:11
Total lines:38
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
GetServiceFabricPartitionCount()-0%100%
GetServiceFabricPartitionOrdinal(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Microsoft.Azure.EventHubs.ServiceFabricProcessor\src\ServiceFabricPartitionLister.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.using System;
 3
 4namespace Microsoft.Azure.EventHubs.ServiceFabricProcessor
 5{
 6    using System;
 7    using System.Fabric;
 8    using System.Fabric.Query;
 9    using System.Threading.Tasks;
 10
 11    class ServiceFabricPartitionLister : IFabricPartitionLister
 12    {
 13        private ServicePartitionList partitionList = null;
 14
 15        public async Task<int> GetServiceFabricPartitionCount(Uri serviceFabricServiceName)
 16        {
 017            using (FabricClient fabricClient = new FabricClient())
 18            {
 019                this.partitionList = await fabricClient.QueryManager.GetPartitionListAsync(serviceFabricServiceName).Con
 020            }
 021            return this.partitionList.Count;
 022        }
 23
 24        public Task<int> GetServiceFabricPartitionOrdinal(Guid serviceFabricPartitionId)
 25        {
 026            int ordinal = -1;
 027            for (int a = 0; a < partitionList.Count; a++)
 28            {
 029                if (this.partitionList[a].PartitionInformation.Id == serviceFabricPartitionId)
 30                {
 031                    ordinal = a;
 032                    break;
 33                }
 34            }
 035            return Task.FromResult<int>(ordinal);
 36        }
 37    }
 38}