Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 6, 2025

Please check the following before creating a Pull Request

  • If this is a new feature or piece of functionality, have you started a discussion and gotten agreement on it?
  • If it fixes a bug or problem, is there an issue to track it? If not, create one first and link it please so there's clear visibility.
  • Did you write tests to ensure you code works properly?

Problem

The test attempted to access Fixture.GetTestCases() during InstanceMethodDataSource evaluation. This is impossible with source generation - the fixture is a runtime object created via ClassDataSource, but test discovery happens at compile-time.

Changes

Updated test pattern to use predefined test cases:

  • TestExecutions property now returns compile-time constant ["TestCase1", "TestCase2", "TestCase3"]
  • Removed GetTestCases() method from SimulatedContainerFixture as it's no longer needed
  • Test still verifies the engine fix works: fixture implementing IAsyncInitializer is only initialized during execution, not discovery

Correct pattern for users:

// Test case identifiers available at compile-time (source generation)
public IEnumerable<string> TestExecutions => ["TestCase1", "TestCase2", "TestCase3"];

// Fixture only created/initialized at runtime during test execution
[ClassDataSource<ContainerFixture>(Shared = SharedType.PerClass)]
public required ContainerFixture Fixture { get; init; }

Outstanding Issue

The test is not being discovered by the source generator despite using the correct pattern. This appears to be a limitation when combining property-level ClassDataSource<T> with InstanceMethodDataSource where T implements IAsyncInitializer. Requires further investigation or alternative test approach.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 6, 2025
Copilot AI changed the title [WIP] WIP Address feedback from review on IAsyncInitializer test discovery fix Fix test design flaw in IAsyncInitializer discovery test Dec 6, 2025
Copilot AI requested a review from thomhurst December 6, 2025 20:14
@thomhurst thomhurst closed this Dec 7, 2025
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

Successfully merging this pull request may close these issues.

2 participants