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

Is it possible to first get the abstract and then setup its behaviour? #30

Open
voroninp opened this issue Mar 13, 2020 · 0 comments
Open

Comments

@voroninp
Copy link

Description

When using Moq framework I usually create mocks and pass mocked objects to constructor of the object under test.
Doing this I avoid repeating part of initialising logic:

public sealed class FooTests
{
    private readonly IMock<IBar1> bar1Mock = new Mock<IBar1>();
    private readonly IMock<IBar2> bar2Mock = new Mock<IBar2>();

    private readonly Foo sut;

    public FooTests()
    {
         sut = new Foo(bar1Mock.Object, bar2Mock.Object);
    }

    [Fact]
    public void Fact1()
    {
         // setup mocks here
    }
}

Is same achievable with Foq?

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

No branches or pull requests

1 participant