Skip to content

Commit d028735

Browse files
committed
test
1 parent 3f16853 commit d028735

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Servers/Kestrel/Kestrel/test/HttpsConfigurationTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ public void NoFallbackToHttpAddress()
7575
});
7676

7777
var host = hostBuilder.Build();
78-
await host.StartAsync();
7978

80-
Assert.Equal(new[] { httpAddress, httpsAddress }, host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses);
79+
var ex = Assert.Throws<InvalidOperationException>(host.Start);
80+
Assert.Contains("Call UseKestrelHttpsConfiguration()", ex.Message);
8181

82-
Assert.Throws<InvalidOperationException>(host.Run);
82+
var addr = Assert.Single(host.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>().Addresses);
83+
// addr will contain the realized port, so we'll remove the port for comparison
84+
Assert.Equal(httpAddress[..^2].ToString(), addr.Substring(0, addr.LastIndexOf(':')));
8385
}
8486

8587
[Theory]

0 commit comments

Comments
 (0)