< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.MsmqTransportSecurity
Assembly: CoreWCF.MSMQ
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.MSMQ/src/CoreWCF/Channels/MsmqTransportSecurity.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 38
Coverable lines: 38
Total lines: 97
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 12
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%
Disable()100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.MSMQ/src/CoreWCF/Channels/MsmqTransportSecurity.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;
 5using System.ComponentModel;
 6using System.Net.Security;
 7
 8namespace CoreWCF.Channels
 9{
 10    public sealed class MsmqTransportSecurity
 11    {
 12        private MsmqAuthenticationMode _msmqAuthenticationMode;
 13        private MsmqEncryptionAlgorithm _msmqEncryptionAlgorithm;
 14        private MsmqSecureHashAlgorithm _msmqHashAlgorithm;
 15        private ProtectionLevel _msmqProtectionLevel;
 16
 017        public MsmqTransportSecurity()
 18        {
 019            _msmqAuthenticationMode = MsmqDefaults.MsmqAuthenticationMode1;
 020            _msmqEncryptionAlgorithm = MsmqDefaults.MsmqEncryptionAlgorithm1;
 021            _msmqHashAlgorithm = MsmqDefaults.MsmqSecureHashAlgorithm;
 022            _msmqProtectionLevel = MsmqDefaults.MsmqProtectionLevel;
 023        }
 24
 025        public MsmqTransportSecurity(MsmqTransportSecurity other)
 26        {
 027            if (null == other)
 028                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(other));
 029            _msmqAuthenticationMode = other.MsmqAuthenticationMode;
 030            _msmqEncryptionAlgorithm = other.MsmqEncryptionAlgorithm;
 031            _msmqHashAlgorithm = other.MsmqSecureHashAlgorithm;
 032            _msmqProtectionLevel = other.MsmqProtectionLevel;
 033        }
 34
 35        internal bool Enabled
 36        {
 37            get
 38            {
 039                return _msmqAuthenticationMode != MsmqAuthenticationMode.None && _msmqProtectionLevel != ProtectionLevel
 40            }
 41        }
 42
 43        [DefaultValue(MsmqDefaults.MsmqAuthenticationMode1)]
 44        public MsmqAuthenticationMode MsmqAuthenticationMode
 45        {
 046            get { return _msmqAuthenticationMode; }
 47            set
 48            {
 049                if (!MsmqAuthenticationModeHelper.IsDefined(value))
 050                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 051                _msmqAuthenticationMode = value;
 052            }
 53        }
 54
 55        [DefaultValue(MsmqDefaults.MsmqEncryptionAlgorithm1)]
 56        public MsmqEncryptionAlgorithm MsmqEncryptionAlgorithm
 57        {
 058            get { return _msmqEncryptionAlgorithm; }
 59            set
 60            {
 061                if (!MsmqEncryptionAlgorithmHelper.IsDefined(value))
 062                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 063                _msmqEncryptionAlgorithm = value;
 064            }
 65        }
 66
 67        [DefaultValue(MsmqDefaults.DefaultMsmqSecureHashAlgorithm)]
 68        public MsmqSecureHashAlgorithm MsmqSecureHashAlgorithm
 69        {
 070            get { return _msmqHashAlgorithm; }
 71            set
 72            {
 073                if (!MsmqSecureHashAlgorithmHelper.IsDefined(value))
 074                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 075                _msmqHashAlgorithm = value;
 076            }
 77        }
 78
 79        [DefaultValue(MsmqDefaults.MsmqProtectionLevel)]
 80        public ProtectionLevel MsmqProtectionLevel
 81        {
 082            get { return _msmqProtectionLevel; }
 83            set
 84            {
 085                if (!ProtectionLevelHelper.IsDefined(value))
 086                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 087                _msmqProtectionLevel = value;
 088            }
 89        }
 90
 91        internal void Disable()
 92        {
 093            _msmqAuthenticationMode = MsmqAuthenticationMode.None;
 094            _msmqProtectionLevel = ProtectionLevel.None;
 095        }
 96    }
 97}