< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.UserNamePasswordValidationModeHelper
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/UserNamePasswordValidationMode.cs
Line coverage
71%
Covered lines: 5
Uncovered lines: 2
Coverable lines: 7
Total lines: 33
Line coverage: 71.4%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
IsDefined(...)50%44100%
Validate(...)50%2250%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/UserNamePasswordValidationMode.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.ComponentModel;
 5
 6namespace CoreWCF.Security
 7{
 8    public enum UserNamePasswordValidationMode
 9    {
 10        Windows,
 11        MembershipProvider,
 12        Custom
 13    }
 14
 15    internal static class UserNamePasswordValidationModeHelper
 16    {
 17        public static bool IsDefined(UserNamePasswordValidationMode validationMode)
 18        {
 1919            return validationMode == UserNamePasswordValidationMode.Windows
 1920                || validationMode == UserNamePasswordValidationMode.MembershipProvider
 1921                || validationMode == UserNamePasswordValidationMode.Custom;
 22        }
 23
 24        public static void Validate(UserNamePasswordValidationMode value)
 25        {
 1926            if (!IsDefined(value))
 27            {
 028                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException(nameof(value)
 029                    typeof(UserNamePasswordValidationMode)));
 30            }
 1931        }
 32    }
 33}