< Summary - CoreWCF Coverage — PR #1766

Information
Class: Helpers.ExceptionCapturingLoggerProvider
Assembly: UnitTests.Common
File(s): /home/runner/work/CoreWCF/CoreWCF/src/Common/UnitTests.Common/Helpers/ExceptionCapturingLoggerProvider.cs
Line coverage
85%
Covered lines: 6
Uncovered lines: 1
Coverable lines: 7
Total lines: 34
Line coverage: 85.7%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%11100%
Dispose()100%110%
CreateLogger(...)50%22100%
GetExceptionsLogged()100%22100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/Common/UnitTests.Common/Helpers/ExceptionCapturingLoggerProvider.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 System.Collections.Concurrent;
 6using System.Collections.Generic;
 7using System.Linq;
 8using Microsoft.Extensions.Logging;
 9
 10namespace Helpers
 11{
 12    public class ExceptionCapturingLoggerProvider : ILoggerProvider
 13    {
 14        private readonly XunitLoggerProvider _wrappedProvider;
 7715        private readonly ConcurrentDictionary<string, ExceptionCapturingLogger> _loggers = new ConcurrentDictionary<stri
 7716        public ExceptionCapturingLoggerProvider(XunitLoggerProvider wrappedProvider)
 17        {
 7718            _wrappedProvider = wrappedProvider;
 7719        }
 20
 21        public void Dispose()
 022        { }
 23
 24        public ILogger CreateLogger(string categoryName)
 25        {
 224126            return _loggers.GetOrAdd(categoryName, new ExceptionCapturingLogger(_wrappedProvider?.CreateLogger(categoryN
 27        }
 28
 29        public IEnumerable<TException> GetExceptionsLogged<TException>() where TException : Exception
 30        {
 3031            return _loggers.SelectMany(l=>l.Value.ExceptionsLogged).OfType<TException>();
 32        }
 33    }
 34}