< Summary

Information
Class: AmbientServices.Test.ExpectedException
Assembly: AmbientServices.Async.Test
File(s): /home/runner/work/AmbientServices.Async/AmbientServices.Async/AmbientServices.Async.Test/ExpectedException.cs
Tag: 76_25271648613
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 40
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
get_TestName()100%11100%
ExpectedException(...)100%11100%
ExpectedException()100%11100%

File(s)

/home/runner/work/AmbientServices.Async/AmbientServices.Async/AmbientServices.Async.Test/ExpectedException.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5using System.Threading.Tasks;
 6
 7namespace AmbientServices.Test
 8{
 9    /// <summary>
 10    /// An exception that indicates that a probable infinite loop was detected and aborted.
 11    /// </summary>
 12    [Serializable]
 13    class ExpectedException : Exception
 14    {
 15        private readonly string? _testName;
 16
 17        /// <summary>
 18        /// Gets the name of the test where this exception was expected.
 19        /// </summary>
 120        public string? TestName => _testName;
 21
 22        /// <summary>
 23        /// Constructs an expected test exception.
 24        /// </summary>
 25        /// <param name="testName">The name of the test case this exception is expected to occur in.</param>
 26        public ExpectedException(string testName)
 127            : base("This exception is expected to occur in the " + testName + " test!")
 28        {
 129            _testName = testName;
 130        }
 31        /// <summary>
 32        /// Constructs an expected test exception.
 33        /// </summary>
 34        public ExpectedException()
 135            : base("This exception is expected to occur during testing!")
 36        {
 137            _testName = null;
 138        }
 39    }
 40}