File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -128,9 +128,10 @@ private void FillInternal(object objectToFill)
128
128
{
129
129
continue ;
130
130
}
131
- if ( currentSetup . PropertyToRandomFunc . ContainsKey ( property ) )
131
+ if ( ContainsProperty ( currentSetup . PropertyToRandomFunc . Keys , property ) )
132
132
{
133
- property . SetValue ( objectToFill , currentSetup . PropertyToRandomFunc [ property ] ( ) , null ) ;
133
+ PropertyInfo p = GetPropertyFromProperties ( currentSetup . PropertyToRandomFunc . Keys , property ) . Single ( ) ;
134
+ property . SetValue ( objectToFill , currentSetup . PropertyToRandomFunc [ p ] ( ) , null ) ;
134
135
continue ;
135
136
}
136
137
@@ -142,7 +143,17 @@ private void FillInternal(object objectToFill)
142
143
143
144
private bool IgnoreProperty ( PropertyInfo property , ObjectFillerSetup currentSetup )
144
145
{
145
- return currentSetup . ProperiesToIgnore . Any ( x => x . MetadataToken == property . MetadataToken && x . Module . Equals ( property . Module ) ) ;
146
+ return ContainsProperty ( currentSetup . PropertiesToIgnore , property ) ;
147
+ }
148
+
149
+ private bool ContainsProperty ( IEnumerable < PropertyInfo > properties , PropertyInfo property )
150
+ {
151
+ return GetPropertyFromProperties ( properties , property ) . Any ( ) ;
152
+ }
153
+
154
+ private IEnumerable < PropertyInfo > GetPropertyFromProperties ( IEnumerable < PropertyInfo > properties , PropertyInfo property )
155
+ {
156
+ return properties . Where ( x => x . MetadataToken == property . MetadataToken && x . Module . Equals ( property . Module ) ) ;
146
157
}
147
158
148
159
private object GetFilledObject ( Type type , ObjectFillerSetup currentSetup )
You can’t perform that action at this time.
0 commit comments