Skip to content
Discussion options

You must be logged in to vote

As part of the same instance (so injected at the same time)? Or two separate invocations, which would end up as different test cases?

For the former, no. For the latter, yes, and that's what the above would do.

If you did want the former, you could use property injection instead.

namespace MyTests
{
  public class MyTestClass
  {
    [ClassDataSource<MyFixture>(Shared = SharedType.Globally)]
    public required MyFixture Fixture1 { get; init; }
  
    [ClassDataSource<AnotherFixture>(Shared = SharedType.ForClass)]
    public required AnotherFixture Fixture2 { get; init; }
  }
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@richardoSGSI
Comment options

@thomhurst
Comment options

Answer selected by richardoSGSI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants