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)
128128 {
129129 continue ;
130130 }
131- if ( currentSetup . PropertyToRandomFunc . ContainsKey ( property ) )
131+ if ( ContainsProperty ( currentSetup . PropertyToRandomFunc . Keys , property ) )
132132 {
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 ) ;
134135 continue ;
135136 }
136137
@@ -142,7 +143,17 @@ private void FillInternal(object objectToFill)
142143
143144 private bool IgnoreProperty ( PropertyInfo property , ObjectFillerSetup currentSetup )
144145 {
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 ) ) ;
146157 }
147158
148159 private object GetFilledObject ( Type type , ObjectFillerSetup currentSetup )
You can’t perform that action at this time.
0 commit comments