< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.NetNamedPipeSecurity
Assembly: CoreWCF.NetNamedPipe
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.NetNamedPipe/src/CoreWCF/NetNamedPipeSecurity.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 21
Coverable lines: 21
Total lines: 66
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%110%
.ctor(...)0%220%
CreateTransportSecurity()0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.NetNamedPipe/src/CoreWCF/NetNamedPipeSecurity.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using CoreWCF.Channels;
 5using System.ComponentModel;
 6using System;
 7using System.Runtime.Versioning;
 8
 9namespace CoreWCF
 10{
 11    [SupportedOSPlatform("windows")]
 12    public sealed class NetNamedPipeSecurity
 13    {
 14        internal const NetNamedPipeSecurityMode DefaultMode = NetNamedPipeSecurityMode.Transport;
 15        private NetNamedPipeSecurityMode _mode;
 016        private NamedPipeTransportSecurity _transport = new NamedPipeTransportSecurity();
 17
 018        public NetNamedPipeSecurity()
 19        {
 020            _mode = DefaultMode;
 021        }
 22
 023        private NetNamedPipeSecurity(NetNamedPipeSecurityMode mode, NamedPipeTransportSecurity transport)
 24        {
 025            _mode = mode;
 026            _transport = transport == null ? new NamedPipeTransportSecurity() : transport;
 027        }
 28
 29        [DefaultValue(DefaultMode)]
 30        public NetNamedPipeSecurityMode Mode
 31        {
 032            get { return _mode; }
 33            set
 34            {
 035                if (!NetNamedPipeSecurityModeHelper.IsDefined(value))
 36                {
 037                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value"));
 38                }
 039                _mode = value;
 040            }
 41        }
 42
 43        public NamedPipeTransportSecurity Transport
 44        {
 045            get { return _transport; }
 46            set
 47            {
 048                if (value == null)
 049                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
 050                _transport = value;
 051            }
 52        }
 53
 54        internal WindowsStreamSecurityBindingElement CreateTransportSecurity()
 55        {
 056            if (_mode == NetNamedPipeSecurityMode.Transport)
 57            {
 058                return _transport.CreateTransportProtectionAndAuthentication();
 59            }
 60            else
 61            {
 062                return null;
 63            }
 64        }
 65    }
 66}