Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Unit Testing Authorize attribute policy

$
0
0

Hi, I would like to test my controller

[Authorize(Policy = "CatalogManager")]
[HttpPut("update")]
public async Task<IActionResult> Update([FromBody] ProductForEditViewModel productForEditViewModel)
{

}

I would like to vérify that only CatalogManager can fire this action.  how can I mock [Authorize(Policy = "CatalogManager")]  attribute?

Best regards


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>