Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions eng/helix/content/runtests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ set InstallPlaywright=%$installPlaywright%
set PLAYWRIGHT_BROWSERS_PATH=%CD%\ms-playwright
set PLAYWRIGHT_DRIVER_PATH=%CD%\.playwright\win-x64\native\playwright.cmd

REM Avoid https://github.com/dotnet/aspnetcore/issues/41937 in current session.
set ASPNETCORE_ENVIRONMENT=

set "PATH=%HELIX_WORKITEM_ROOT%;%PATH%;%HELIX_WORKITEM_ROOT%\node\bin"
echo Set path to: "%PATH%"
echo.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,24 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.AspNetCore.Mvc.FunctionalTests
{
public class SimpleWithWebApplicationBuilderTests : IClassFixture<MvcTestFixture<SimpleWebSiteWithWebApplicationBuilder.FakeStartup>>
{
private readonly MvcTestFixture<SimpleWebSiteWithWebApplicationBuilder.FakeStartup> _fixture;

public SimpleWithWebApplicationBuilderTests(MvcTestFixture<SimpleWebSiteWithWebApplicationBuilder.FakeStartup> fixture)
public SimpleWithWebApplicationBuilderTests(MvcTestFixture<SimpleWebSiteWithWebApplicationBuilder.FakeStartup> fixture,
ITestOutputHelper helper)
{
_fixture = fixture;
Client = _fixture.CreateDefaultClient();
Helper = helper;
}

public HttpClient Client { get; }
public ITestOutputHelper Helper { get; }

[Fact]
public async Task HelloWorld()
Expand Down Expand Up @@ -131,7 +135,7 @@ public async Task MvcControllerActionWorks()
Assert.Equal("Hello human", content);
}

[Fact(Skip = "Failing on Windows environments: https://github.com/dotnet/aspnetcore/issues/41937")]
[Fact]
public async Task DefaultEnvironment_Is_Development()
{
// Arrange
Expand All @@ -142,6 +146,14 @@ public async Task DefaultEnvironment_Is_Development()
var content = await client.GetStringAsync("http://localhost/environment");

// Assert
if (!string.Equals(expected, content))
{
// Get more information when this test is going to fail.
var configContent = await client.GetStringAsync("http://localhost/config");

Helper.WriteLine($"Configuration debug view: '{configContent}'");
}

Assert.Equal(expected, content);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
app.MapGet("/problem", () => Results.Problem("Some problem"));

app.MapGet("/environment", (IHostEnvironment environment) => environment.EnvironmentName);
app.MapGet("/config", (IConfiguration config, HttpContext context) => {
return context.Response.WriteAsync(((IConfigurationRoot)config).GetDebugView());
});

app.MapGet("/webroot", (IWebHostEnvironment environment) => environment.WebRootPath);

app.MapGet("/greeting", (IConfiguration config) => config["Greeting"]);
Expand Down