< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.ServiceContractAttribute
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/ServiceContractAttribute.cs
Line coverage
74%
Covered lines: 20
Uncovered lines: 7
Coverable lines: 27
Total lines: 83
Line coverage: 74%
Branch coverage
58%
Covered branches: 7
Total branches: 12
Branch coverage: 58.3%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/ServiceContractAttribute.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.Description;
 6
 7namespace CoreWCF
 8{
 9    [AttributeUsage(CoreWCFAttributeTargets.ServiceContract, Inherited = false, AllowMultiple = false)]
 10    public sealed class ServiceContractAttribute : Attribute
 11    {
 12        private string _configurationName;
 13        private string _name;
 14        private string _ns;
 15        private SessionMode _sessionMode;
 16
 17        public string ConfigurationName
 18        {
 67819            get { return _configurationName; }
 20            set
 21            {
 6222                if (value == null)
 23                {
 024                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(value));
 25                }
 6226                if (value == string.Empty)
 27                {
 028                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 029                        SR.SFxConfigurationNameCannotBeEmpty));
 30                }
 6231                _configurationName = value;
 6232            }
 33        }
 34
 35        public string Name
 36        {
 67837            get { return _name; }
 38            set
 39            {
 374040                if (value == null)
 41                {
 042                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(value));
 43                }
 374044                if (value == string.Empty)
 45                {
 046                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 047                        SR.SFxNameCannotBeEmpty));
 48                }
 374049                _name = value;
 374050            }
 51        }
 52
 53        public string Namespace
 54        {
 67855            get { return _ns; }
 56            set
 57            {
 371658                if (!string.IsNullOrEmpty(value))
 59                {
 353060                    NamingHelper.CheckUriProperty(value, "Namespace");
 61                }
 62
 371663                _ns = value;
 371664            }
 65        }
 66
 67        public SessionMode SessionMode
 68        {
 67869            get { return _sessionMode; }
 70            set
 71            {
 29672                if (!SessionModeHelper.IsDefined(value))
 73                {
 074                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 75                }
 76
 29677                _sessionMode = value;
 29678            }
 79        }
 80
 168281        public Type CallbackContract { get; set; }
 82    }
 83}