Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 31, 2025

This PR adds comprehensive MSTest support to skUnit, demonstrating that the framework is truly test-framework agnostic. Previously, all documentation and samples used xUnit exclusively, which could mislead users into thinking skUnit had a dependency on xUnit.

What's Changed

🆕 New Demo Project: Demo.MSTest

  • Complete working MSTest project showing all key patterns
  • Demonstrates [TestClass], [TestMethod], [DataTestMethod], and [ClassInitialize] attributes
  • Shows proper TestContext.WriteLine integration for test output
  • Includes sample scenarios for semantic, JSON, and basic chat testing

📖 Enhanced Documentation

  • Updated README.md with side-by-side examples comparing xUnit, MSTest, and NUnit
  • New docs/test-framework-integration.md - comprehensive guide covering all three major test frameworks
  • Updated demos/README.md to include the new MSTest demo

🧪 Framework Comparison Examples

The new documentation shows how the same test looks across frameworks:

xUnit:

[Fact]
public async Task TestGreeting()
{
    await _scenarioAssert.PassAsync(scenarios, _chatClient);
}

MSTest:

[TestMethod] 
public async Task TestGreeting()
{
    await ScenarioAssert.PassAsync(scenarios, _chatClient);
}

The documentation examples now correctly include the required chatClient parameter in all PassAsync calls and follow best practices by reusing ScenarioAssert instances rather than creating them per test.

Why This Matters

This change proves that skUnit's architecture is genuinely framework-agnostic. The core skUnit library has zero dependencies on test frameworks - it only depends on Microsoft.Extensions.AI, SemanticKernel.Abstractions, and Markdig. Users can now confidently choose their preferred test framework without worrying about compatibility.

Validation

  • ✅ All existing tests pass - zero breaking changes
  • ✅ New demo project builds and discovers tests correctly
  • ✅ Documentation examples are syntactically correct and match working code
  • ✅ Code formatting follows project standards

Fixes #37.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update documentation and samples to include MSTest usage Add MSTest support with comprehensive documentation and demo project Aug 31, 2025
Copilot AI requested a review from mehrandvd August 31, 2025 17:16
Copilot finished work on behalf of mehrandvd August 31, 2025 17:16
Updated the `ChatScenarioTests` class to utilize a static property for `ScenarioAssert`, initialized in the `ClassInitialize` method. This change enhances logging consistency by using `context.WriteLine` and reduces redundancy by reusing the same `ScenarioAssert` instance across all test methods.
$"MyProject.Scenarios.{scenarioName}.md",
typeof(ChatTests).Assembly);

await scenarioAssert.PassAsync(scenarios);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot The PassAsync method requires a chatClient too. Follow the samples in Demo.MSTest style and don't create scenarioAssert instances per test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit b8bb30c. Updated all PassAsync calls to include the required chatClient parameter and refactored examples to follow the Demo.MSTest pattern using static ScenarioAssert instances instead of creating them per test method.

Copilot AI requested a review from mehrandvd August 31, 2025 18:00
Copilot finished work on behalf of mehrandvd August 31, 2025 18:00
@mehrandvd mehrandvd marked this pull request as ready for review August 31, 2025 19:46
@mehrandvd mehrandvd merged commit fac944b into main Aug 31, 2025
2 checks passed
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.

Update documentation and samples to include MSTest usage

2 participants