-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathBindingRegistryExtensions.cs
More file actions
29 lines (26 loc) · 964 Bytes
/
Copy pathBindingRegistryExtensions.cs
File metadata and controls
29 lines (26 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using TechTalk.SpecFlow.Bindings;
using TechTalk.SpecFlow.Bindings.Reflection;
namespace SpecFlow.Unity
{
public static class BindingRegistryExtensions
{
public static IEnumerable<IBindingType> GetBindingTypes(this IBindingRegistry bindingRegistry)
{
return bindingRegistry.GetStepDefinitions().Cast<IBinding>()
.Concat(bindingRegistry.GetHooks().Cast<IBinding>())
.Concat(bindingRegistry.GetStepTransformations())
.Select(b => b.Method.Type)
.Distinct();
}
public static IEnumerable<Assembly> GetBindingAssemblies(this IBindingRegistry bindingRegistry)
{
return bindingRegistry.GetBindingTypes().OfType<RuntimeBindingType>()
.Select(t => t.Type.Assembly)
.Distinct()
.ToList();
}
}
}