< Summary

Class:Microsoft.Azure.Batch.IntegrationTestCommon.Tests.Helpers.CertificateCredentialsNetCore
Assembly:Microsoft.Azure.Batch.IntegrationTestCommon
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\tests\IntegrationTestCommon\Helpers\CertificateCredentialsNetCore.cs
Covered lines:0
Uncovered lines:6
Coverable lines:6
Total lines:26
Line coverage:0% (0 of 6)
Covered branches:0
Total branches:2
Branch coverage:0% (0 of 2)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\tests\IntegrationTestCommon\Helpers\CertificateCredentialsNetCore.cs

#LineLine coverage
 1using Microsoft.Rest;
 2using System.Linq;
 3using System.Net.Http;
 4using System.Security.Cryptography.X509Certificates;
 5
 6namespace Microsoft.Azure.Batch.IntegrationTestCommon.Tests.Helpers
 7{
 8#if !FullNetFx
 9    /// <summary>
 10    /// Work around due being unavailable in .netcore
 11    /// </summary>
 12    class CertificateCredentialsNetCore : ServiceClientCredentials
 13    {
 14        private X509Certificate2 cert;
 015        public CertificateCredentialsNetCore(X509Certificate2 cert)
 16        {
 017            this.cert = cert;
 018        }
 19        public override void InitializeServiceClient<T>(ServiceClient<T> client)
 20        {
 021            HttpClientHandler handler = client.HttpMessageHandlers.FirstOrDefault(h => h is HttpClientHandler) as HttpCl
 022            handler.ClientCertificates.Add(this.cert);
 023        }
 24    }
 25#endif
 26}