< Summary

Information
Class: MyNet.UI.Attributes.AttributeExtensions
Assembly: MyNet.UI
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/Attributes/AttributeExtensions.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 30
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsRegisteredAsTransient(...)100%11100%
IsRegisteredAsSingleton(...)100%11100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/Attributes/AttributeExtensions.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="AttributeExtensions.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.Linq;
 9using System.Reflection;
 10
 11namespace MyNet.UI.Attributes;
 12
 13public static class AttributeExtensions
 14{
 15    extension(Type type)
 16    {
 17        /// <summary>
 18        /// Determines whether the specified type is registered as transient in the dependency injection container by ch
 19        /// </summary>
 20        /// <returns><see langword="true"/> if the type is registered as transient; otherwise, <see langword="false"/>.<
 621        public bool IsRegisteredAsTransient() => type.GetCustomAttributes<IsTransientAttribute>().Any();
 22
 23        /// <summary>
 24        /// Determines whether the specified type is registered as a singleton in the dependency injection container by 
 25        /// </summary>
 26        /// <returns><see langword="true"/> if the type is registered as a singleton; otherwise, <see langword="false"/>
 627        public bool IsRegisteredAsSingleton() => type.GetCustomAttributes<IsSingletonAttribute>().Any();
 28    }
 29}
 30