< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Web.WebGetAttribute
Assembly: CoreWCF.WebHttp
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.WebHttp/src/CoreWCF/Web/WebGetAttribute.cs
Line coverage
87%
Covered lines: 28
Uncovered lines: 4
Coverable lines: 32
Total lines: 113
Line coverage: 87.5%
Branch coverage
62%
Covered branches: 5
Total branches: 8
Branch coverage: 62.5%
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/WebGetAttribute.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 WebGetAttribute : Attribute, IOperationContractAttributeProvider, IOperationBehavior
 13    {
 14        private WebMessageBodyStyle _bodyStyle;
 15        private WebMessageFormat _requestMessageFormat;
 16        private WebMessageFormat _responseMessageFormat;
 17
 114418        public WebGetAttribute()
 19        {
 114420        }
 21
 22        public WebMessageBodyStyle BodyStyle
 23        {
 34424            get { return _bodyStyle; }
 25            set
 26            {
 68027                if (!WebMessageBodyStyleHelper.IsDefined(value))
 28                {
 029                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 30                }
 31
 68032                _bodyStyle = value;
 68033                IsBodyStyleSetExplicitly = true;
 68034            }
 35        }
 36
 123237        public bool IsBodyStyleSetExplicitly { get; private set; }
 38
 4839        public bool IsRequestFormatSetExplicitly { get; private set; }
 40
 84641        public bool IsResponseFormatSetExplicitly { get; private set; }
 42
 43        public WebMessageFormat RequestFormat
 44        {
 45            get
 46            {
 47
 2448                return _requestMessageFormat;
 49            }
 50            set
 51            {
 2452                if (!WebMessageFormatHelper.IsDefined(value))
 53                {
 054                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 55                }
 56
 2457                _requestMessageFormat = value;
 2458                IsRequestFormatSetExplicitly = true;
 2459            }
 60        }
 61
 62        public WebMessageFormat ResponseFormat
 63        {
 64            get
 65            {
 66
 11067                return _responseMessageFormat;
 68            }
 69            set
 70            {
 68471                if (!WebMessageFormatHelper.IsDefined(value))
 72                {
 073                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 74                }
 75
 68476                _responseMessageFormat = value;
 68477                IsResponseFormatSetExplicitly = true;
 68478            }
 79        }
 80
 162281        public string UriTemplate { get; set; }
 82
 83        void IOperationBehavior.AddBindingParameters(OperationDescription operationDescription, BindingParameterCollecti
 84        {
 13885        } //  do nothing
 86
 87        void IOperationBehavior.ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOpe
 88        {
 089        } //  do nothing
 90
 91        void IOperationBehavior.ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispa
 92        {
 13893        } //  do nothing
 94
 95        void IOperationBehavior.Validate(OperationDescription operationDescription)
 96        {
 13797        } //  do nothing
 98
 99        internal WebMessageBodyStyle GetBodyStyleOrDefault(WebMessageBodyStyle defaultStyle)
 100        {
 552101            if (IsBodyStyleSetExplicitly)
 102            {
 344103                return BodyStyle;
 104            }
 105            else
 106            {
 208107                return defaultStyle;
 108            }
 109        }
 110
 137111        OperationContractAttribute IOperationContractAttributeProvider.GetOperationContractAttribute() => new OperationC
 112    }
 113}