< Summary

Class:SVETA.Api.Helpers.Authorize.MethodAuthorizeAttribute
Assembly:SVETA.Api
File(s):/opt/dev/sveta_api_build/SVETA.Api/Helpers/Authorize/MethodAuthorizeAttribute.cs
Covered lines:0
Uncovered lines:10
Coverable lines:10
Total lines:30
Line coverage:0% (0 of 10)
Covered branches:0
Total branches:2
Branch coverage:0% (0 of 2)

Metrics

MethodLine coverage Branch coverage
.ctor(...)0%100%
get_MethodName()0%0%
set_MethodName(...)0%100%

File(s)

/opt/dev/sveta_api_build/SVETA.Api/Helpers/Authorize/MethodAuthorizeAttribute.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Authorization;
 2using System;
 3using System.Collections.Generic;
 4using System.Linq;
 5using System.Threading.Tasks;
 6
 7namespace SVETA.Api.Helpers.Authorize
 8{
 9    public class MethodAuthorizeAttribute: AuthorizeAttribute
 10    {
 11        const string POLICY_PREFIX = "Method";
 012        public MethodAuthorizeAttribute(string method) => MethodName = method;
 13
 14        public string MethodName
 15        {
 16            get
 017            {
 018                if (Policy.Substring(POLICY_PREFIX.Length).Length > 0)
 019                {
 020                    return Policy.Substring(POLICY_PREFIX.Length);
 21                }
 022                return default(string);
 023            }
 24            set
 025            {
 026                Policy = $"{POLICY_PREFIX}{value}";
 027            }
 28        }
 29    }
 30}