Skip to content

CombinatorialMemberData not being newed up for each test #39

Open
@pellet

Description

@pellet

I used the beta version of xunit.combinatorial to use the CombinatorialMemberData feature but unfortunately the data instances were being shared between tests and causing my mocks call verification to fail due to the calls being summed up over all the tests in the theory.
I managed to get around the issue temporarily by doing something like:

[Theory, CombinatorialData]
public void CombinatorialMemberDataFromProperties(
    [CombinatorialMemberData(nameof(MockCombinations))] Func<IMock> createMock,
    bool boolParam
)
{
    var mock = createMock();
    Assert.NotNull(mock);
}
public static IEnumerable<Func<IMock?>> MockCombinations =>
  new [] 
  {
    () => new MockA(),
    () => null as IMock
  }

Any help will be appreciated, btw thanks for the great job in creating this library... well done 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions