< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Description.MessageDescription
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Description/MessageDescription.cs
Line coverage
92%
Covered lines: 35
Uncovered lines: 3
Coverable lines: 38
Total lines: 177
Line coverage: 92.1%
Branch coverage
88%
Covered branches: 23
Total branches: 26
Branch coverage: 88.4%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%11100%
.ctor(...)50%2285.71%
.ctor(...)50%4481.81%
Clone()100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Description/MessageDescription.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 CoreWCF.Channels;
 6
 7namespace CoreWCF.Description
 8{
 9    public class MessageDescription
 10    {
 11        private static Type s_typeOfUntypedMessage;
 12        private MessageDescriptionItems _items;
 13
 14        //XmlQualifiedName xsdType;
 15
 1008616        public MessageDescription(string action, MessageDirection direction) : this(action, direction, null) { }
 17
 520918        internal MessageDescription(string action, MessageDirection direction, MessageDescriptionItems items)
 19        {
 520920            if (!MessageDirectionHelper.IsDefined(direction))
 21            {
 022                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(directi
 23            }
 24
 520925            Action = action;
 520926            Direction = direction;
 520927            _items = items;
 520928        }
 29
 8030        internal MessageDescription(MessageDescription other)
 31        {
 8032            Action = other.Action;
 8033            Direction = other.Direction;
 8034            Items.Body = other.Items.Body.Clone();
 16035            foreach (MessageHeaderDescription mhd in other.Items.Headers)
 36            {
 037                Items.Headers.Add(mhd.Clone() as MessageHeaderDescription);
 38            }
 16039            foreach (MessagePropertyDescription mpd in other.Items.Properties)
 40            {
 041                Items.Properties.Add(mpd.Clone() as MessagePropertyDescription);
 42            }
 8043            MessageName = other.MessageName;
 8044            MessageType = other.MessageType;
 8045        }
 46
 47        public MessageDescription Clone()
 48        {
 8049            return new MessageDescription(this);
 50        }
 51
 1945952        public string Action { get; internal set; }
 53
 54        public MessageBodyDescription Body
 55        {
 17282756            get { return Items.Body; }
 57        }
 58
 1519859        public MessageDirection Direction { get; }
 60
 61        public MessageHeaderDescriptionCollection Headers
 62        {
 1575063            get { return Items.Headers; }
 64        }
 65
 66        public MessagePropertyDescriptionCollection Properties
 67        {
 548968            get { return Items.Properties; }
 69        }
 70
 71        internal MessageDescriptionItems Items
 72        {
 73            get
 74            {
 19448475                if (_items == null)
 76                {
 509877                    _items = new MessageDescriptionItems();
 78                }
 79
 19448480                return _items;
 81            }
 82        }
 83
 50284        internal bool HasProtectionLevel => false;
 85
 86        internal static Type TypeOfUntypedMessage
 87        {
 88            get
 89            {
 1531090                if (s_typeOfUntypedMessage == null)
 91                {
 1092                    s_typeOfUntypedMessage = typeof(Message);
 93                }
 1531094                return s_typeOfUntypedMessage;
 95            }
 96        }
 97
 73298        internal XmlName MessageName { get; set; }
 99
 25646100        public Type MessageType { get; set; }
 101
 102        internal bool IsTypedMessage
 103        {
 104            get
 105            {
 22616106                return MessageType != null;
 107            }
 108        }
 109
 110        internal bool IsUntypedMessage
 111        {
 112            get
 113            {
 18695114                return (Body.ReturnValue != null && Body.Parts.Count == 0 && Body.ReturnValue.Type == TypeOfUntypedMessa
 18695115                     (Body.ReturnValue == null && Body.Parts.Count == 1 && Body.Parts[0].Type == TypeOfUntypedMessage);
 116            }
 117        }
 118
 119        internal bool IsVoid
 120        {
 121            get
 122            {
 10224123                return !IsTypedMessage && Body.Parts.Count == 0 && (Body.ReturnValue == null || Body.ReturnValue.Type ==
 124            }
 125        }
 126    }
 127
 128    internal class MessageDescriptionItems
 129    {
 130        private MessageHeaderDescriptionCollection _headers;
 131        private MessageBodyDescription _body;
 132        private MessagePropertyDescriptionCollection _properties;
 133
 134        internal MessageBodyDescription Body
 135        {
 136            get
 137            {
 138                if (_body == null)
 139                {
 140                    _body = new MessageBodyDescription();
 141                }
 142
 143                return _body;
 144            }
 145            set
 146            {
 147                _body = value;
 148            }
 149        }
 150
 151        internal MessageHeaderDescriptionCollection Headers
 152        {
 153            get
 154            {
 155                if (_headers == null)
 156                {
 157                    _headers = new MessageHeaderDescriptionCollection();
 158                }
 159
 160                return _headers;
 161            }
 162        }
 163
 164        internal MessagePropertyDescriptionCollection Properties
 165        {
 166            get
 167            {
 168                if (_properties == null)
 169                {
 170                    _properties = new MessagePropertyDescriptionCollection();
 171                }
 172
 173                return _properties;
 174            }
 175        }
 176    }
 177}