Skip to content

Conversation

fabiocav
Copy link
Member

@fabiocav fabiocav commented May 16, 2025

resolves #15

Initial set of unit tests

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • I have added all required tests (Unit tests, E2E tests)

@fabiocav fabiocav requested a review from Copilot May 16, 2025 01:25
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces the initial set of unit tests for several core functionalities and refactors some internal classes to support optional encryption in client state handling. Key changes include:

  • New unit tests for unique ID generation, token conversion, and attribute properties.
  • Enhancements to the ClientStateManager methods to optionally handle encrypted client states.
  • Restructuring of solution and project files for improved organization.

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/Extensions.Mcp.Tests/UtilityTests.cs Added tests to verify unique ID generation and valid character checks.
test/Extensions.Mcp.Tests/TokenUtilityTests_Extra.cs Added tests for key byte conversion and encryption key retrieval handling.
test/Extensions.Mcp.Tests/TokenUtilityTests.cs Introduced round-trip tests for URI state protection and reading.
test/Extensions.Mcp.Tests/McpToolTriggerAttributeTests.cs Added tests validating attribute property assignment.
test/Extensions.Mcp.Tests/McpToolPropertyAttributeTests.cs Added tests for tool property attribute correctness.
test/Extensions.Mcp.Tests/McpOptionsTests.cs Validates that default values in options are set correctly.
test/Extensions.Mcp.Tests/McpBackplaneMessageTests.cs Tests for proper assignment and retrieval of backplane message properties.
test/Extensions.Mcp.Tests/Extensions.Mcp.Tests.csproj Updated unit test project configuration and dependencies.
test/Extensions.Mcp.Tests/DefaultMcpInstanceIdProviderTests.cs Added tests for ensuring non-null and unique instance IDs.
test/Extensions.Mcp.Tests/ClientStateManagerTests.cs Added round-trip tests for formatting and parsing client states.
src/Microsoft.Azure.Functions.Extensions.Mcp/Extensions.Mcp.csproj Updated package references and project configurations.
src/Microsoft.Azure.Functions.Extensions.Mcp/DefaultMcpInstanceIdProvider.cs Simplified namespace usage by removing extraneous using statements.
src/Microsoft.Azure.Functions.Extensions.Mcp/ClientStateManager.cs Modified state parsing/formatting methods to include an optional encryption flag.
src/Microsoft.Azure.Functions.Extensions.Mcp/AssemblyInfo.cs Added InternalsVisibleTo attribute for test assembly access.
Microsoft.Azure.Functions.Extensions.Mcp.sln Restructured the solution file with updated project references for better organization.
Comments suppressed due to low confidence (4)

Microsoft.Azure.Functions.Extensions.Mcp.sln:7

  • [nitpick] Ensure that the updated solution structure and project references are fully aligned with the repository organization, and confirm that no unintended dependencies were removed.
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"

src/Microsoft.Azure.Functions.Extensions.Mcp/ClientStateManager.cs:9

  • Consider adding XML documentation to clarify how the 'isEncrypted' parameter affects the parsing behavior in different environments.
public static bool TryParseUriState(string clientState, [NotNullWhen(true)] out string? clientId, [NotNullWhen(true)] out string? instanceId, bool isEncrypted = true)

src/Microsoft.Azure.Functions.Extensions.Mcp/ClientStateManager.cs:20

  • Consider adding XML documentation to explain how the 'isEncrypted' parameter influences the state formatting logic, especially the conditions under which encryption is bypassed.
public static string FormatUriState(string clientId, string instanceId, bool isEncrypted = true)

src/Microsoft.Azure.Functions.Extensions.Mcp/DefaultMcpInstanceIdProvider.cs:1

  • Verify that the removal of the Microsoft.Extensions.Hosting namespace does not affect dependency injection configurations or interface implementations that rely on it.
namespace Microsoft.Azure.Functions.Extensions.Mcp;

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.

MCP extension unit test coverage
2 participants