Skip to content

Commit

Permalink
refactor TestBindingSource attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusz96 committed Dec 15, 2023
1 parent 9091b64 commit 09a9409
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public void VoidAction()
}

[HttpGet]
public string? Test25([TestBindingSourceMetadata("Header")] string apiKey)
public string? Test25([TestBindingSource("Header")] string apiKey)
{
return _uriGenerator.GetUriByExpression<AttributeRoutingController>(
HttpContext,
Expand Down
18 changes: 18 additions & 0 deletions test/UriGeneration.IntegrationTests/TestBindingSourceAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;

namespace UriGeneration.IntegrationTests
{
public class TestBindingSourceAttribute : Attribute, IBindingSourceMetadata
{
public TestBindingSourceAttribute(string bindingSource)
{
BindingSource = bindingSource switch
{
"Header" => BindingSource.Header,
_ => null
};
}

public BindingSource? BindingSource { get; }
}
}

This file was deleted.

0 comments on commit 09a9409

Please sign in to comment.