I am updating my E2E tests in blazor-state and my test application now uses the new Generic IHost in Program.cs
In my ServerFixture I was doing StartAndGetRootUri just like @SteveSandersonMS code.
protected override string StartAndGetRootUri()
{
_host = CreateWebHost();
RunInBackgroundThread(_host.Start);
return _host.ServerFeatures
.Get<IServerAddressesFeature>()
.Addresses.Single();
}
With the new IHost I don't have ServerFeatures, So I am wondering how do we get the Addresss information from IHost?
If you update your DevHostServer You will be in the same boat.
I searched and couldn't figure out so asked where I thought it would be most helpful.
Thanks!
C#
protected override string StartAndGetRootUri()
{
_host = CreateWebHost();
RunInBackgroundThread(_host.Start);
return _host.Services.GetRequiredService<IServer>().Features
.Get<IServerAddressesFeature>()
.Addresses.Single();
}
@davidfowl Thanks I knew you guys would know. Now I guess I can do a PR to update your tests?
You mean to update the tests to use Host instead of WebHost? Sure, I think that would be OK.
It might be very hard but give it a shot.
cc @natemcmaster
Most helpful comment
C# protected override string StartAndGetRootUri() { _host = CreateWebHost(); RunInBackgroundThread(_host.Start); return _host.Services.GetRequiredService<IServer>().Features .Get<IServerAddressesFeature>() .Addresses.Single(); }