-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[Azure Mgmt Generator] Add mocking documentation to extension methods #53969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…nerator Co-authored-by: ArcturusZhang <10554446+ArcturusZhang@users.noreply.github.com>
There was a problem hiding this 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 adds mocking documentation to extension methods generated by the Azure Management Generator. Previously, these extension methods lacked guidance on how users should mock them for testing purposes. The implementation adds an <item> block within the XML <summary> tag to direct users to mock the corresponding method in the mockable resource provider instead.
Key Changes:
- Modified
BuildRedirectMethodto acceptMockableResourceProviderinstead of justCSharpTypeto access mockable type metadata - Added
AddMockingDocumentationmethod to inject mocking instructions into method XML documentation - Added
BuildMockingDescriptionhelper to construct method references with parameter type information
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/src/Providers/ExtensionProvider.cs | Modified to generate mocking documentation for extension methods, including new methods to build and inject XML documentation |
| eng/packages/http-client-csharp-mgmt/generator/TestProjects/Local/Mgmt-TypeSpec/src/Generated/Extensions/AzureGeneratorMgmtTypeSpecTestsExtensions.cs | Test output showing generated mocking documentation added to all extension methods across various ARM resource types |
Description
Extension methods in the Azure Management Generator were missing XML documentation to guide users on mocking. The previous generator included this documentation in an
<item>block within the<summary>tag, but the new TypeSpec-based generator omitted it.Changes
BuildRedirectMethodto generate mocking documentation for all extension methodsMockableResourceProviderinstead ofCSharpTypeto access mockable type metadataAddMockingDocumentationmethod to inject<item>block with mocking instructionsBuildMockingDescriptionhelper to construct method references with parameter typesGenerated Output
Extension methods now include mocking guidance:
Applies to all ARM extension methods across ArmClient, ResourceGroupResource, SubscriptionResource, TenantResource, and ManagementGroupResource.
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
Testing Guidelines
SDK Generation Guidelines
*.csprojandAssemblyInfo.csfiles have been updated with the new version of the SDK.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.