• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NetFabric / NetFabric.CodeAnalysis / 6101088975

06 Sep 2023 06:36PM UTC coverage: 82.932% (+2.0%) from 80.942%
6101088975

push

github

web-flow
Add support for GetEnumerator as an extension method (#26)

* Add support for GetEnumerator as an extension method

* Fixes

224 of 264 branches covered (0.0%)

Branch coverage included in aggregate %.

127 of 127 new or added lines in 16 files covered. (100.0%)

636 of 773 relevant lines covered (82.28%)

17.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

58.33
/NetFabric.Reflection/Reflection/EnumerableInfo.cs
1
using System.Reflection;
2

3
namespace NetFabric.Reflection
4
{
5
    /// <summary>
6
    /// Contains information about methods and properties that ´foreach´ will use to enumerate a given type.
7
    /// </summary>
8
    public class EnumerableInfo
9
    {
10
        /// <summary>
11
        /// Indicates if 'foreach' will use the indexer instead of the enumerator.
12
        /// </summary>
13
        public bool ForEachUsesIndexer { get; }
×
14

15
        /// <summary>
16
        /// Information on the method that 'foreach' will use to get a new instance of the enumerator.
17
        /// </summary>
18
        public MethodInfo GetEnumerator { get; }
121✔
19
        
20
        /// <summary>
21
        /// Information on the enumerator methods that 'foreach' will use.
22
        /// </summary>
23
        public EnumeratorInfo EnumeratorInfo { get; }
134✔
24

25
        internal EnumerableInfo(bool forEachUsesIndexer, MethodInfo getEnumerator, EnumeratorInfo enumeratorInfo)
73✔
26
        {
27
            ForEachUsesIndexer = forEachUsesIndexer;
73✔
28
            GetEnumerator = getEnumerator;
73✔
29
            EnumeratorInfo = enumeratorInfo;
73✔
30
        }
73✔
31

32
        public object InvokeGetEnumerator(object instance)
33
        {
34
            try
35
            {
36
                return GetEnumerator.Invoke(instance, null)!;
×
37
            }
38
            catch (TargetInvocationException exception)
×
39
            {
40
                throw new EnumerationException($"Unhandled exception in {GetEnumerator.DeclaringType!.Name}.GetEnumerator().", exception.InnerException!);
×
41
            }
42
        }
×
43
    }
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc