forked from dotnet/aspnetcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve endpoint metadata debugging (dotnet#48207)
Co-authored-by: Sean Farrow <sean.farrow@seanfarrow.co.uk>
- Loading branch information
1 parent
c084d4b
commit ba58563
Showing
35 changed files
with
480 additions
and
24 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Microsoft.AspNetCore.Routing; | ||
|
||
public class MetadataTest | ||
{ | ||
[Fact] | ||
public void EndpointDescriptionAttribute_ToString() | ||
{ | ||
// Arrange | ||
var metadata = new EndpointDescriptionAttribute("A description"); | ||
|
||
// Act | ||
var value = metadata.ToString(); | ||
|
||
// Assert | ||
Assert.Equal("Description: A description", value); | ||
} | ||
|
||
[Fact] | ||
public void EndpointSummaryAttribute_ToString() | ||
{ | ||
// Arrange | ||
var metadata = new EndpointSummaryAttribute("A summary"); | ||
|
||
// Act | ||
var value = metadata.ToString(); | ||
|
||
// Assert | ||
Assert.Equal("Summary: A summary", value); | ||
} | ||
|
||
[Fact] | ||
public void HostAttribute_ToString() | ||
{ | ||
// Arrange | ||
var metadata = new TagsAttribute("Tag1", "Tag2"); | ||
|
||
// Act | ||
var value = metadata.ToString(); | ||
|
||
// Assert | ||
Assert.Equal("Tags: Tag1,Tag2", value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Diagnostics; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Shared; | ||
|
||
namespace Microsoft.AspNetCore.Routing; | ||
|
||
/// <summary> | ||
/// Indicates that this <see cref="Endpoint"/> should not be included in the generated API metadata. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Delegate, AllowMultiple = false, Inherited = true)] | ||
[DebuggerDisplay("{ToString(),nq}")] | ||
public sealed class ExcludeFromDescriptionAttribute : Attribute, IExcludeFromDescriptionMetadata | ||
{ | ||
/// <inheritdoc /> | ||
public bool ExcludeFromDescription => true; | ||
|
||
/// <inheritdoc/>> | ||
public override string ToString() | ||
{ | ||
return DebuggerHelpers.GetDebugText(nameof(ExcludeFromDescription), ExcludeFromDescription); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.