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

Quick-action for introducing fake in constructor argument #138

Closed
ffMathy opened this issue Feb 29, 2020 · 8 comments · Fixed by #141
Closed

Quick-action for introducing fake in constructor argument #138

ffMathy opened this issue Feb 29, 2020 · 8 comments · Fixed by #141
Labels
enhancement New feature or request
Milestone

Comments

@ffMathy
Copy link

ffMathy commented Feb 29, 2020

Let's say that I have ServiceA with dependencies ServiceB and ServiceC:

class ServiceA {
    public ServiceA(ServiceB serviceB, ServiceC serviceC) { }
}

Now, if I type:

var service = new ServiceA(

It would be awesome if Roslyn would suggest an action called Introduce Substitute for ServiceB, which would turn the code into:

var fakeServiceB = Substitute.For<ServiceB>();
var service = new ServiceA(fakeServiceB
@tpodolak tpodolak added the enhancement New feature or request label Mar 1, 2020
@tpodolak
Copy link
Member

@ffMathy it seems to be possible to do that. Here are some preliminary results
introducesubstitute

@ffMathy
Copy link
Author

ffMathy commented Mar 18, 2020

Woah that'll be insanely useful! Can't wait until it is up! ♥️

@ffMathy
Copy link
Author

ffMathy commented Mar 19, 2020

Is there an ETA on when it'll be published to NuGet?

tpodolak added a commit that referenced this issue Mar 21, 2020
tpodolak added a commit that referenced this issue Mar 21, 2020
tpodolak added a commit that referenced this issue Mar 21, 2020
tpodolak added a commit that referenced this issue Mar 21, 2020
tpodolak added a commit that referenced this issue Mar 21, 2020
tpodolak added a commit that referenced this issue Mar 22, 2020
tpodolak added a commit that referenced this issue Mar 22, 2020
tpodolak added a commit that referenced this issue Mar 22, 2020
tpodolak added a commit that referenced this issue Mar 22, 2020
tpodolak added a commit that referenced this issue Mar 22, 2020
tpodolak added a commit that referenced this issue Mar 22, 2020
@tpodolak
Copy link
Member

tpodolak commented Mar 22, 2020

Is there an ETA on when it'll be published to NuGet?

I've just opened PR for this feature so I guess we should be able to release it within 1 or 2 weeks

@ffMathy
Copy link
Author

ffMathy commented Mar 23, 2020

Great to hear, and perfect that you linked this issue.

Looking forward to it. Thanks again.

@tpodolak
Copy link
Member

tpodolak commented Apr 8, 2020

@ffMathy released in 1.0.13

@ffMathy
Copy link
Author

ffMathy commented Apr 21, 2020

Hmmm @dtchepak these don't work for me in Visual Studio 2019 (latest update). Can you get them working? I noticed you're using Rider in your example.

@tpodolak
Copy link
Member

I have only access to VS Community and it works fine there
VisualStudio
Please note that usually Visual Studio doesnt pick up new rules/refactoring directly after package update/install so the restart is required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants