© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
1 reply
Kris__

❔ Blazor webassembly app hosted ASP.NET Core 7 test with WebApplicationFactory

I have a Blazor webassembly app hosted in ASP.NET Core 7 that I want to run some tests on.

I'm trying to swap out the authentication setup (azure b2c) with a in memory version of IdentityServer while testing.

I'm able to start the host using WebApplicationFactory and modify the services.
protected override void ConfigureWebHost(IWebHostBuilder builder)
protected override void ConfigureWebHost(IWebHostBuilder builder)


But I need to apply some changes to the Blazor Webassembly client before I start the server.

I can't figure out how to access the builder object in the Webassembly Program.cs.

You can find my code at https://github.com/kristiangronli/BlazorWebAssemblyWithPlaywright

My WebApplicationFactory is in the directory test -> XunitPlaywright -> Auth -> IndividualAuthWebApplicationFactory.cs

Any help would be very much appreciated.
GitHub
GitHub - kristiangronli/BlazorWebAssemblyWithPlaywright
Contribute to kristiangronli/BlazorWebAssemblyWithPlaywright development by creating an account on GitHub.
GitHub - kristiangronli/BlazorWebAssemblyWithPlaywright
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

ASP.NET Core Blazor + EF error
C#CC# / help
3y ago
Run ASP.NET Core app in Test Container
C#CC# / help
12mo ago
✅ ASP.NET CORE with React.js or ASP.NET CORE WEB APP
C#CC# / help
3y ago
Configuration of Testcontainer, WebApplicationFactory and ConfigurationSource in ASP.NET Core.
C#CC# / help
14mo ago