I'm using ThinkTecture's resource based authorization in my WebApi.
I'm trying to test one of my controller that I need to check the access inside the function. But now, I can't test the function anymore since, I can't mock an extension method and since it's a nuget method, I can't modify the class to inject another value.
public async Task<IHttpActionResult> Get(int id)
{
if (!(await Request.CheckAccessAsync(ChinookResources.AlbumActions.View,
ChinookResources.Album,
id.ToString())))
{
return this.AccessDenied();
}
return Ok();
}
Source code of the ThinkTecture project is here.
Thank you for your help
Aucun commentaire:
Enregistrer un commentaire