Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 18005

How Azure Function can be unit tested?

$
0
0

How the Azure Function like the one below could be unit tested?How blob storage can be mocked?

    [Function("Blob_GetTodoById")]public IActionResult GetTodoById(    [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = Route +"/{id}")] HttpRequest req,    [BlobInput(BlobPath +"/{id}.json", Connection = "AzureWebJobsStorage")] string json,    string id){    logger.LogInformation("Getting todo item by id");    if (json == null)    {        logger.LogInformation($"Item {id} not found");        return new NotFoundResult();    }    return new OkObjectResult(JsonConvert.DeserializeObject<Todo>(json));}

Viewing all articles
Browse latest Browse all 18005


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