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

loresoft / FluentCommand / 6648415992

26 Oct 2023 01:49AM UTC coverage: 51.645% (+0.1%) from 51.515%
6648415992

push

github

pwelter34
Update InsertBuilder.cs

981 of 2442 branches covered (0.0%)

Branch coverage included in aggregate %.

2896 of 5065 relevant lines covered (57.18%)

156.37 hits per line

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

0.0
/src/FluentCommand/Reflection/MethodAccessor.cs
1
using System.Diagnostics;
2
using System.Reflection;
3

4
namespace FluentCommand.Reflection;
5

6
/// <summary>
7
/// An accessor class for <see cref="MethodInfo"/>.
8
/// </summary>
9
[DebuggerDisplay("Name: {Name}")]
10
public class MethodAccessor : IMethodAccessor
11
{
12
    private readonly Lazy<Func<object, object[], object>> _invoker;
13

14
    /// <summary>
15
    /// Initializes a new instance of the <see cref="MethodAccessor"/> class.
16
    /// </summary>
17
    /// <param name="methodInfo">The method info.</param>
18
    public MethodAccessor(MethodInfo methodInfo)
19
    {
20
        if (methodInfo == null)
×
21
            throw new ArgumentNullException(nameof(methodInfo));
×
22

23
        MethodInfo = methodInfo;
24
        Name = methodInfo.Name;
×
25
        _invoker = new Lazy<Func<object, object[], object>>(() => ExpressionFactory.CreateMethod(MethodInfo));
×
26
    }
×
27

28
    /// <summary>
29
    /// Gets the method info.
30
    /// </summary>
31
    public MethodInfo MethodInfo { get; }
32

33
    /// <summary>
34
    /// Gets the name of the member.
35
    /// </summary>
36
    /// <value>
37
    /// The name of the member.
38
    /// </value>
39
    public string Name { get; }
40

41
    /// <summary>
42
    /// Invokes the method on the specified <paramref name="instance"/>.
43
    /// </summary>
44
    /// <param name="instance">The object on which to invoke the method. If a method is static, this argument is ignored.</param>
45
    /// <param name="arguments">An argument list for the invoked method.</param>
46
    /// <returns>
47
    /// An object containing the return value of the invoked method.
48
    /// </returns>
49
    public object Invoke(object instance, params object[] arguments)
50
    {
51
        return _invoker.Value.Invoke(instance, arguments);
×
52
    }
53

54
    /// <summary>
55
    /// Gets the method key using a hash code from the name and paremeter types.
56
    /// </summary>
57
    /// <param name="name">The name of the method.</param>
58
    /// <param name="parameterTypes">The method parameter types.</param>
59
    /// <returns>The method key</returns>
60
    internal static int GetKey(string name, IEnumerable<Type> parameterTypes)
61
    {
62
        return Internal.HashCode.Seed
×
63
            .Combine(name)
×
64
            .CombineAll(parameterTypes);
×
65
    }
66
}
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