< Summary

Class:Microsoft.Azure.EventGrid.Models.ResourceCredentials
Assembly:Microsoft.Azure.EventGrid
File(s):C:\Git\azure-sdk-for-net\sdk\eventgrid\Microsoft.Azure.EventGrid\src\Customization\Models\ResourceCredentials.cs
Covered lines:7
Uncovered lines:0
Coverable lines:7
Total lines:31
Line coverage:100% (7 of 7)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
InitializeServiceClient(...)-100%100%
ProcessHttpRequestAsync()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventgrid\Microsoft.Azure.EventGrid\src\Customization\Models\ResourceCredentials.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5using System.Net.Http;
 6using System.Threading;
 7using System.Threading.Tasks;
 8using Microsoft.Rest;
 9
 10namespace Microsoft.Azure.EventGrid.Models
 11{
 12    public class ResourceCredentials : ServiceClientCredentials
 13    {
 14        readonly string resourceKey;
 15
 216        public ResourceCredentials(string resourceKey)
 17        {
 218            this.resourceKey = resourceKey;
 219        }
 20
 21        public override void InitializeServiceClient<T>(ServiceClient<T> client)
 22        {
 223        }
 24
 25        public override async Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationTok
 26        {
 227            request.Headers.Add("aeg-sas-key", this.resourceKey);
 228            await base.ProcessHttpRequestAsync(request, cancellationToken).ConfigureAwait(false);
 229        }
 30    }
 31}