Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Enable default server address test #1436

Merged
merged 1 commit into from
Mar 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure;
using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -129,7 +130,7 @@ private async Task RegisterIPEndPoint_Success(IPEndPoint endPoint, Func<IPEndPoi
}
}

[ConditionalFact(Skip = "Waiting on https://github.com/aspnet/Hosting/issues/917")]
[ConditionalFact]
[PortSupportedCondition(5000)]
public async Task DefaultsToPort5000()
{
Expand All @@ -147,13 +148,14 @@ public async Task DefaultsToPort5000()
{
host.Start();

var debugLog = testLogger.Messages.Single(log => log.LogLevel == LogLevel.Debug);
Assert.True(debugLog.Message.Contains("default"));
Assert.Equal(5000, host.GetPort());
Assert.Single(testLogger.Messages, log => log.LogLevel == LogLevel.Debug &&
string.Equals($"No listening endpoints were configured. Binding to {Constants.DefaultIPEndPoint} by default.",
log.Message, StringComparison.Ordinal));

foreach (var testUrl in new[] { "http://127.0.0.1:5000", "http://localhost:5000" })
foreach (var testUrl in new[] { "http://127.0.0.1:5000", /* "http://[::1]:5000" */})
{
var response = await HttpClientSlim.GetStringAsync(testUrl);
Assert.Equal(new Uri(testUrl).ToString(), response);
Assert.Equal(new Uri(testUrl).ToString(), await HttpClientSlim.GetStringAsync(testUrl));
}
}
}
Expand Down