< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.NonceCache
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/NonceCache.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 15
Coverable lines: 15
Total lines: 64
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/NonceCache.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.Runtime;
 6
 7namespace CoreWCF.Security
 8{
 9    public abstract class NonceCache
 10    {
 11        private TimeSpan _cachingTime;
 12        private int _maxCachedNonces;
 13
 14        /// <summary>
 15        /// TThe max timespan after which a Nonce is deleted from the NonceCache. This value should be atleast twice the
 16        /// </summary>
 17        public TimeSpan CachingTimeSpan
 18        {
 19            get
 20            {
 021                return _cachingTime;
 22            }
 23            set
 24            {
 025                if (value < TimeSpan.Zero)
 26                {
 027                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 028                        SR.Format(SRCommon.SFxTimeoutOutOfRange0)));
 29                }
 30
 031                if (TimeoutHelper.IsTooLarge(value))
 32                {
 033                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 034                        SRCommon.SFxTimeoutOutOfRangeTooBig));
 35                }
 36
 037                _cachingTime = value;
 038            }
 39        }
 40
 41        /// <summary>
 42        /// The maximum size of the NonceCache.
 43        /// </summary>
 44        public int CacheSize
 45        {
 46            get
 47            {
 048                return _maxCachedNonces;
 49            }
 50            set
 51            {
 052                if (value < 0)
 53                {
 054                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 055                                                    SRCommon.ValueMustBeNonNegative));
 56                }
 057                _maxCachedNonces = value;
 058            }
 59        }
 60
 61        public abstract bool TryAddNonce(byte[] nonce);
 62        public abstract bool CheckNonce(byte[] nonce);
 63    }
 64}