< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.NetMsmqSecurity
Assembly: CoreWCF.MSMQ
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.MSMQ/src/CoreWCF/Channels/NetMsmqSecurity.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 25
Coverable lines: 25
Total lines: 84
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(...)100%110%
.ctor(...)100%110%
ConfigureTransportSecurity(...)0%440%
CreateMessageSecurity()100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.MSMQ/src/CoreWCF/Channels/NetMsmqSecurity.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 System.ComponentModel;
 5
 6namespace CoreWCF.Channels
 7{
 8    public sealed class NetMsmqSecurity
 9    {
 10        internal const NetMsmqSecurityMode DefaultMode = NetMsmqSecurityMode.Transport;
 11        private NetMsmqSecurityMode _mode;
 12        private MsmqTransportSecurity _transportSecurity;
 13        private MessageSecurityOverMsmq _messageSecurity;
 14
 15        public NetMsmqSecurity()
 016            : this(DefaultMode, null, null)
 17        {
 018        }
 19
 20        internal NetMsmqSecurity(NetMsmqSecurityMode mode)
 021            : this(mode, null, null)
 22        {
 023        }
 24
 025        private NetMsmqSecurity(NetMsmqSecurityMode mode, MsmqTransportSecurity transportSecurity, MessageSecurityOverMs
 26        {
 27            // Fx.Assert(NetMsmqSecurityModeHelper.IsDefined(mode), string.Format("Invalid NetMsmqSecurityMode value: {0
 28
 029            _mode = mode;
 030            _transportSecurity = new MsmqTransportSecurity();
 031            _messageSecurity = new MessageSecurityOverMsmq();
 032        }
 33
 34        [DefaultValue(DefaultMode)]
 35        public NetMsmqSecurityMode Mode
 36        {
 037            get { return _mode; }
 38            set
 39            {
 40                //if (!NetMsmqSecurityModeHelper.IsDefined(value))
 41                //{
 42                //    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(v
 43                //}
 044                _mode = value;
 045            }
 46        }
 47
 48        public MsmqTransportSecurity Transport
 49        {
 50            get
 51            {
 052                if (_transportSecurity == null)
 053                    _transportSecurity = new MsmqTransportSecurity();
 054                return _transportSecurity;
 55            }
 056            set { _transportSecurity = value; }
 57        }
 58
 59        public MessageSecurityOverMsmq Message
 60        {
 61            get
 62            {
 063                if (_messageSecurity == null)
 064                    _messageSecurity = new MessageSecurityOverMsmq();
 065                return _messageSecurity;
 66            }
 067            set { _messageSecurity = value; }
 68        }
 69
 70        internal void ConfigureTransportSecurity(MsmqBindingElementBase msmq)
 71        {
 072            if (_mode == NetMsmqSecurityMode.Transport || _mode == NetMsmqSecurityMode.Both)
 073                msmq.MsmqTransportSecurity = Transport;
 74            else
 075                msmq.MsmqTransportSecurity.Disable();
 076        }
 77
 78
 79        internal SecurityBindingElement CreateMessageSecurity()
 80        {
 081            return Message.CreateSecurityBindingElement();
 82        }
 83    }
 84}