最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - How to perform integration testing on Azure Function apps, similar to using Microsoft.AspNetCore.Mvc.Testing? - Stack Overf

programmeradmin4浏览0评论

I want to perform integration testing on an Azure Function app (.NET 9 / isolated worker), similar to how it's normally performed using Microsoft.AspNetCore.Mvc.Testing on ASP.NET Core apps:

.AspNetCore.Mvc.Testing

The Function app is created using an FunctionsApplicationBuilder:

var builder = FunctionsApplication.CreateBuilder(args);
...
var host = builder.Build()
await host.Run()

For ASP.NET Core apps, I would normally use the testing package above to create an in-memory instance of my web application, with mocked out services, e.g. database, and then call the endpoints using HttpClient.PostAsJsonAsync.

In case of Function apps, this package doesn't apply, so how would I perform similar testing?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论