@@ -10,35 +10,26 @@ namespace NetArchTest.Rules
1010 /// </summary>
1111 internal sealed class FunctionSequence
1212 {
13- private readonly List < List < IFunctionCall > > _groups ;
13+ private readonly List < List < IFunctionCall > > groups ;
1414
1515
16- /// <summary>
17- /// Initializes a new instance of the <see cref="FunctionSequence"/> class.
18- /// </summary>
19- internal FunctionSequence ( )
16+ public FunctionSequence ( )
2017 {
21- _groups = new List < List < IFunctionCall > > ( ) ;
22- _groups . Add ( new List < IFunctionCall > ( ) ) ;
18+ groups = new List < List < IFunctionCall > > ( ) ;
19+ groups . Add ( new List < IFunctionCall > ( ) ) ;
2320 }
2421
2522
26- /// <summary>
27- /// Adds a function call to the current list.
28- /// </summary>
29- internal void AddFunctionCall < T > ( FunctionDelegates . FunctionDelegate < T > method , T value , bool condition )
23+ public void AddFunctionCall < T > ( FunctionDelegates . FunctionDelegate < T > method , T value , bool condition )
3024 {
31- _groups . Last ( ) . Add ( new FunctionCall ( method , value , condition ) ) ;
25+ groups . Last ( ) . Add ( new FunctionCall < T > ( method , value , condition ) ) ;
3226 }
33-
34- /// <summary>
35- /// Creates a new logical grouping of function calls.
36- /// </summary>
37- internal void CreateGroup ( )
27+ public void CreateGroup ( )
3828 {
39- _groups . Add ( new List < IFunctionCall > ( ) ) ;
29+ groups . Add ( new List < IFunctionCall > ( ) ) ;
4030 }
4131
32+
4233 /// <summary>
4334 /// Executes all the function calls that have been specified.
4435 /// </summary>
@@ -60,7 +51,7 @@ private void MarkPassingTypes(IEnumerable<TypeSpec> inputTypes)
6051 {
6152 inputTypes . ForEach ( x => x . IsSelected = false ) ;
6253
63- foreach ( var group in _groups )
54+ foreach ( var group in groups )
6455 {
6556 IEnumerable < TypeSpec > passingTypes = inputTypes ;
6657
@@ -74,43 +65,26 @@ private void MarkPassingTypes(IEnumerable<TypeSpec> inputTypes)
7465 }
7566 }
7667
77- /// <summary>
78- /// Represents a single function call.
79- /// </summary>
80- internal class FunctionCall : IFunctionCall
68+
69+ internal class FunctionCall < T > : IFunctionCall
8170 {
82- /// <summary>
83- /// Initializes a new instance of the <see cref="FunctionCall"/> class.
84- /// </summary>
85- internal FunctionCall ( Delegate func , object value , bool condition )
71+ public FunctionDelegates . FunctionDelegate < T > FunctionDelegate { get ; }
72+ public T FunctionArgument { get ; }
73+ public bool Condition { get ; }
74+
75+
76+ public FunctionCall ( FunctionDelegates . FunctionDelegate < T > func , T argument , bool condition )
8677 {
8778 this . FunctionDelegate = func ;
88- this . Value = value ;
79+ this . FunctionArgument = argument ;
8980 this . Condition = condition ;
9081 }
9182
9283
9384 public IEnumerable < TypeSpec > Execute ( IEnumerable < TypeSpec > inputTypes )
9485 {
95- return FunctionDelegate . DynamicInvoke ( inputTypes , Value , Condition ) as IEnumerable < TypeSpec > ;
86+ return FunctionDelegate ( inputTypes , FunctionArgument , Condition ) ;
9687 }
97-
98-
99- /// <summary>
100- /// A delegate for a function call.
101- /// </summary>
102- public Delegate FunctionDelegate { get ; private set ; }
103-
104- /// <summary>
105- /// The input value for the function call.
106- /// </summary>
107- public object Value { get ; private set ; }
108-
109- /// <summary>
110- /// The Condition to apply to the call - i.e. "is" or "is not".
111- /// </summary>
112- public bool Condition { get ; private set ; }
113-
11488 }
11589
11690 internal interface IFunctionCall
0 commit comments