I have created an integration test project to mock API with WireMock.Net library. My application is a Blazor WebAssembly with ASP.NET Core Hosted. However, when I try to debug my test case I get this exception error: "Could not load type 'WebAssembly.JSInterop.JSCallInfo' assembly 'Microsoft.JSInterop.WebAssembly, Version=7.0.2.0". What could be the cause of this error?
Here is my integration test project looks like
public class ContactControllerTests : IClassFixture<WebApplicationFactory<Program>>
{
public ContactControllerTests(WebApplicationFactory<Program> applicationFactory)
{
_httpClient = applicationFactory.CreateDefaultClient();
}
[Fact]
public async Task GetContacts_WhenGetAll_ThenReturnAllContacts()
{
}
}
And in the same project, I have a 'Program.cs' file that has this configuration
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using System.Net.Http.Headers;
....//some other usings
var builder = WebAssemblyHostBuilder.CreateDefault(args); //Here is where it throws the exception
builder.RootComponents.Add<App>("#app");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
await builder.Build().RunAsync();
public partial class Program { }
With the above configuration, it looks like I am not able to create an in-memory test server that is hosting WebAssembly. I would appreciate any help or feedback.