< Summary

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

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\eventgrid\Azure.Messaging.EventGrid\src\Customization\EventGridSharedAccessSignatureCredentialPolicy.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Text;
 7using Azure.Core;
 8using Azure.Core.Pipeline;
 9
 10namespace Azure.Messaging.EventGrid
 11{
 12    internal class EventGridSharedAccessSignatureCredentialPolicy : HttpPipelineSynchronousPolicy
 13    {
 14        private readonly EventGridSharedAccessSignatureCredential _credential;
 15
 16        /// <summary>
 17        /// Initializes a new instance of the <see cref="EventGridSharedAccessSignatureCredentialPolicy"/> class.
 18        /// </summary>
 19        /// <param name="credential">The <see cref="EventGridSharedAccessSignatureCredential"/> used to authenticate req
 420        public EventGridSharedAccessSignatureCredentialPolicy(EventGridSharedAccessSignatureCredential credential)
 21        {
 422            Argument.AssertNotNull(credential, nameof(credential));
 423            _credential = credential;
 424        }
 25
 26        /// <inheritdoc/>
 27        public override void OnSendingRequest(HttpMessage message)
 28        {
 429            base.OnSendingRequest(message);
 430            message.Request.Headers.SetValue(Constants.SasTokenName, _credential.Signature);
 431        }
 32    }
 33}

Methods/Properties

.ctor(...)
OnSendingRequest(...)