You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That comment mentions avoiding multiple construction of objects. My (perhaps incorrect) assumption had been that it also could encourage more deterministic behavior by avoiding referencing instance data when generating test cases.
I admit, I haven't read the whole thread just yet. And, of course, decisions can always be revisited.
@jnm2 At one point you were advocating for going further towards statics in #3537. I'm unsure if that was simply for API consistency or if you had other design considerations in mind too at the time?
At the moment we require the members that are passed into the
TestCaseSource
andValueSource
attributes to bestatic
.However, if the name is
null
we assume theTestFixture
itself is anIEnumerable
and we actually instantiate the fixture to return the test parameters.What is the reason, not to allow instance fields for the other source members?
Code wise the change wouldn't be too difficult.
object instance = member.IsStatic ? null : Reflect.Construct(sourceType, null)
Then update all further code to pass
instance
instead ofnull
?The text was updated successfully, but these errors were encountered: