Is there a way with xUnit to test that a method has specific attributes on it?
[HttpGet]
[SwaggerOperation(OperationId = "blah", Summary = "blah", Description = "blah")]
[ProducesResponseType((int)HttpStatusCode.OK)]
public async Task<ActionResult<IList<string>>> GetSomething
(
[Required, FromRoute(Name = "blah")] Guid aGuid,
)
{}
I would like to be able to test that [HttpGet]
and all of the other attributes exist on the GetSomething
method. Also, if possible would like to check that the [Required]
attribute is on the method parameter aGuid