< Summary

Information
Class: ArturRios.Data.MongoDb.CollectionName
Assembly: ArturRios.Data.MongoDb
File(s): D:\Repositories\dotnet-data\src\ArturRios.Data.MongoDb\CollectionName.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 17
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage
100%
Covered methods: 2
Fully covered methods: 2
Total methods: 2
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
For()100%44100%

File(s)

D:\Repositories\dotnet-data\src\ArturRios.Data.MongoDb\CollectionName.cs

#LineLine coverage
 1using System.Collections.Concurrent;
 2using System.Reflection;
 3
 4namespace ArturRios.Data.MongoDb;
 5
 6/// <summary>Resolves the MongoDB collection name for a document type.</summary>
 7public static class CollectionName
 8{
 19    private static readonly ConcurrentDictionary<Type, string> Cache = new();
 10
 11    /// <summary>
 12    ///     Returns the <see cref="MongoCollectionAttribute" /> name for <typeparamref name="T" /> if present,
 13    ///     otherwise the type name.
 14    /// </summary>
 15    public static string For<T>() where T : Document =>
 5516        Cache.GetOrAdd(typeof(T), static t => t.GetCustomAttribute<MongoCollectionAttribute>()?.Name ?? t.Name);
 17}

Methods/Properties

.cctor()
For()