Skip to content

Add HttpMethod.Query to static method test data#129790

Open
NicoAvanzDev wants to merge 5 commits into
dotnet:mainfrom
NicoAvanzDev:httpmethod-query-test-data
Open

Add HttpMethod.Query to static method test data#129790
NicoAvanzDev wants to merge 5 commits into
dotnet:mainfrom
NicoAvanzDev:httpmethod-query-test-data

Conversation

@NicoAvanzDev

Copy link
Copy Markdown
Contributor

Summary

  • Add HttpMethod.Query to the shared static HttpMethod test data.
  • Ensure the static-method hash-code coverage includes the QUERY singleton.

Testing

  • .\build.cmd -subset clr+libs -rc Release
  • .\dotnet.cmd test src\libraries\System.Net.Http\tests\FunctionalTests\System.Net.Http.Functional.Tests.csproj --filter FullyQualifiedName~HttpMethodTest

Copilot AI review requested due to automatic review settings June 24, 2026 07:44
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 24, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the HttpMethodTest functional tests to include the HttpMethod.Query singleton in the shared static-method test data used by the hash-code theory, improving coverage consistency for built-in HttpMethod instances.

Changes:

  • Add HttpMethod.Query to the StaticHttpMethods test data set used by [MemberData].
  • Update the static-method list formatting to accommodate the new entry.

Comment on lines +21 to +25
new object[] { HttpMethod.Delete },
new object[] { HttpMethod.Head },
new object[] { HttpMethod.Options },
new object[] { HttpMethod.Trace }
new object[] { HttpMethod.Trace },
new object[] { HttpMethod.Query }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment looks right.

If we're already making changes here, mind making StaticHttpMethods a List<HttpMethod> instead, then using it in all tests in this file?
There's no point listing out the same list 3 times like is done currently, and the AddStaticHttpMethods helper doesn't make sense either.

Replace separate MemberData lists with a single canonical StaticHttpMethods
List<HttpMethod> containing all known HTTP methods (Connect, Delete, Get, Head,
Options, Patch, Post, Put, Query, Trace).

Convert GetHashCode_StaticMethods and Parse_KnownMethod tests from Theory
with MemberData to Fact with foreach loops over StaticHttpMethods. Remove
the Parse_UsesKnownInstances_MemberData helper and AddStaticHttpMethods
static initializer — the list is now declared directly as a field.

This eliminates the duplication of having the static methods list defined
in three different places.
Copilot AI review requested due to automatic review settings June 25, 2026 12:13
@NicoAvanzDev

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment on lines +114 to 116
[Fact]
public void GetHashCode_StaticMethods_SameAsStringToUpperInvariantHashCode()
{
Comment on lines +152 to 154
[Fact]
public void Parse_KnownMethod_UsesKnownInstances()
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Net.Http community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants