< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Web.WebInvokeAttribute
Assembly: CoreWCF.WebHttp
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Web/WebInvokeAttribute.cs
Line coverage
84%
Covered lines: 28
Uncovered lines: 5
Coverable lines: 33
Total lines: 115
Line coverage: 84.8%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Web/WebInvokeAttribute.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;
 6using CoreWCF.Description;
 7using CoreWCF.Dispatcher;
 8
 9namespace CoreWCF.Web
 10{
 11    [AttributeUsage(AttributeTargets.Method)]
 12    public sealed class WebInvokeAttribute : Attribute, IOperationContractAttributeProvider, IOperationBehavior
 13    {
 14        private WebMessageBodyStyle _bodyStyle;
 15        private WebMessageFormat _requestMessageFormat;
 16        private WebMessageFormat _responseMessageFormat;
 17
 24418        public WebInvokeAttribute()
 19        {
 24420        }
 21
 22        public WebMessageBodyStyle BodyStyle
 23        {
 9724            get { return _bodyStyle; }
 25            set
 26            {
 20027                if (!WebMessageBodyStyleHelper.IsDefined(value))
 28                {
 029                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 30                }
 31
 20032                _bodyStyle = value;
 20033                IsBodyStyleSetExplicitly = true;
 20034            }
 35        }
 36
 29737        public bool IsBodyStyleSetExplicitly { get; private set; }
 38
 13639        public bool IsRequestFormatSetExplicitly { get; private set; }
 40
 22341        public bool IsResponseFormatSetExplicitly { get; private set; }
 42
 29143        public string Method { get; set; }
 44
 45        public WebMessageFormat RequestFormat
 46        {
 47            get
 48            {
 49
 2250                return _requestMessageFormat;
 51            }
 52            set
 53            {
 11454                if (!WebMessageFormatHelper.IsDefined(value))
 55                {
 056                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 57                }
 58
 11459                _requestMessageFormat = value;
 11460                IsRequestFormatSetExplicitly = true;
 11461            }
 62        }
 63
 64        public WebMessageFormat ResponseFormat
 65        {
 66            get
 67            {
 68
 4469                return _responseMessageFormat;
 70            }
 71            set
 72            {
 17673                if (!WebMessageFormatHelper.IsDefined(value))
 74                {
 075                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 76                }
 77
 17678                _responseMessageFormat = value;
 17679                IsResponseFormatSetExplicitly = true;
 17680            }
 81        }
 82
 34183        public string UriTemplate { get; set; }
 84
 85        void IOperationBehavior.AddBindingParameters(OperationDescription operationDescription, BindingParameterCollecti
 86        {
 2587        } //  do nothing
 88
 89        void IOperationBehavior.ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOpe
 90        {
 091        } //  do nothing
 92
 93        void IOperationBehavior.ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispa
 94        {
 2595        } //  do nothing
 96
 97        void IOperationBehavior.Validate(OperationDescription operationDescription)
 98        {
 2599        } //  do nothing
 100
 101        internal WebMessageBodyStyle GetBodyStyleOrDefault(WebMessageBodyStyle defaultStyle)
 102        {
 97103            if (IsBodyStyleSetExplicitly)
 104            {
 97105                return BodyStyle;
 106            }
 107            else
 108            {
 0109                return defaultStyle;
 110            }
 111        }
 112
 25113        OperationContractAttribute IOperationContractAttributeProvider.GetOperationContractAttribute() => new OperationC
 114    }
 115}