Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Conversation

@kzu
Copy link
Member

@kzu kzu commented Oct 28, 2020

This is one of the most annoying scenarios when mocking APIs that have ref/out arguments. Figuring out the callback parameters, setting up the right output values in an untyped collection of some sort, it's terrible.

So rather than that, offer a built-in way to generate a delegate that can be used to directly set up and implement the method, with full typed arguments including ref/out annotations, just like you would if you implemented the interface manually (which you likely do when things get complicated because of this issue!).

When you get to the setup and specify the method you want to work with, you get a nice codefix suggestion that generates the delegate and the Returns call with the right parameters:

RefOut

Setting up tests for this will be more complicated than for built-in analyzers, pending further investigation.

This is one of the most annoying scenarios when mocking APIs that have ref/out arguments. Figuring out the callback parameters, setting up the right output values in an untyped collection of some sort, it's terrible.

So rather than that, offer a built-in way to generate a delegate that can be used to directly set up and implement the method, with full typed arguments including ref/out annotations, just like you would if you implemented the interface manually (which you likely do when things get complicated because of this issue!).

For easier troubleshooting a VSIX project is also provided so you can more easily debug the completion provider.

Setting up tests for this will be more complicated than for built-in analyzers, pending further investigation.
@kzu kzu merged commit 6d229a8 into main Oct 29, 2020
@kzu kzu deleted the dev branch October 29, 2020 03:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant