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 code fix for NS5001 #181

Closed
tpodolak opened this issue Jan 16, 2022 · 0 comments · Fixed by #182
Closed

Add code fix for NS5001 #181

tpodolak opened this issue Jan 16, 2022 · 0 comments · Fixed by #182
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tpodolak
Copy link
Member

Add code fix provider which removes redundant Received call from Received.InOrder checks

Before fix

using NSubstitute;
using NSubstitute.ReceivedExtensions;

namespace MyNamespace
{
    public interface IFoo
    {
        int Bar();
        int Bar(int x);
    }

    public class FooTests
    {
        public void Test()
        {
            var substitute = NSubstitute.Substitute.For<IFoo>();
            Received.InOrder(() =>
            { 
                substitute.Received().Bar();
                substitute.Received().Bar(Arg.Any<int>());
            });
        }
    }
}

after fix

using NSubstitute;
using NSubstitute.ReceivedExtensions;

namespace MyNamespace
{
    public interface IFoo
    {
        int Bar();
        int Bar(int x);
    }

    public class FooTests
    {
        public void Test()
        {
            var substitute = NSubstitute.Substitute.For<IFoo>();
            Received.InOrder(() =>
            { 
                substitute.Bar();
                substitute.Bar(Arg.Any<int>());
            });
        }
    }
}
@tpodolak tpodolak added the enhancement New feature or request label Jan 16, 2022
@tpodolak tpodolak self-assigned this Jan 16, 2022
tpodolak added a commit that referenced this issue Jan 16, 2022
tpodolak added a commit that referenced this issue Jan 16, 2022
tpodolak added a commit that referenced this issue Jan 16, 2022
tpodolak added a commit that referenced this issue Jan 16, 2022
tpodolak added a commit that referenced this issue Jan 28, 2022
tpodolak added a commit that referenced this issue Jan 28, 2022
…in-order-code-fix

GH-181 - code fix provider for NS5001
@tpodolak tpodolak added this to the 1.0.16 milestone Jan 8, 2023
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.

1 participant