Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add collection adapter for the Engine #1018

Open
zvirja opened this issue Apr 11, 2018 · 5 comments
Open

Add collection adapter for the Engine #1018

zvirja opened this issue Apr 11, 2018 · 5 comments
Milestone

Comments

@zvirja
Copy link
Member

zvirja commented Apr 11, 2018

Currently in order to modify "Engine" builders, you need to pass a customized engine to the Fixture constructor. That approach works, however is pretty inconvenient.

Instead, I suggest to add a collection adapter like Customizations to make the replacement of default builders.

@DeafLight
Copy link

Hi @zvirja, any news on this one ? I'll use the #1017 approach for now, but this enhancement would be a great addition IMHO.

Thanks! :)

@zvirja
Copy link
Member Author

zvirja commented Feb 18, 2019

Hi @xlecoustillier,

Yes, please use the approach from #1017 for now. It will be done one day, but not in the nearby future, unfortunately.

@DeafLight
Copy link

DeafLight commented Feb 21, 2019

Thanks, will do. I guess it is not the most used feature in AF anyway :)

@DeafLight
Copy link

DeafLight commented Mar 3, 2019

Do you have an approach in mind for this feature ? I would be happy to do a PR for this whenever I find any time (yeah, I know 😅).

As said in the DefaultRelays class, removing too many of the specimen builders is likely to prevent AutoFixture from working as expected. On the other hand, adding a MethodQuery for instance means to be able to play with what's passed to the MethodInvoker (unless having several MethodInvokers in the relays list is possible, I didn't check the behavior in this case).

So, in your opinion, which would be the API for this ? fixture.Customizations accepts only SpecimenBuilders, i.e. no MethodQuery, which seems to rule out this approach.
Or should we overload the Customize extension to accept MethodQuery as well and that would build the CompositeMethodQuery along the way ?

Let me know if you have any insights.

Thanks ! 😃

@zvirja
Copy link
Member Author

zvirja commented Mar 17, 2019

@SilentLux Well, my initial idea was just to be able to access all ISpecimenBuilder instances we have inside the "engine", so you can remove the existing ones or add your own ones. Speaking of MehodQuery (I suppose we speak about 'these lines'), you would just add one more MethodInvoker with the queries you need. The scenario with "patching" (like we saw in #1017) will be solved similarly. I don't think we should add specific API for this particular case.

@aivascu aivascu added this to the future milestone Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants