// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Net; using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Testing.xunit; using Xunit; namespace Microsoft.AspNetCore.Diagnostics.FunctionalTests { public class DatabaseErrorPageSampleTest : IClassFixture> { public DatabaseErrorPageSampleTest(TestFixture fixture) { Client = fixture.Client; } public HttpClient Client { get; } [ConditionalFact] [OSSkipCondition(OperatingSystems.Linux)] [OSSkipCondition(OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2)] public async Task DatabaseErrorPage_ShowsError() { // Arrange var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/"); // Act var response = await Client.SendAsync(request); // Assert var body = await response.Content.ReadAsStringAsync(); Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); Assert.Contains("In Visual Studio, use the Package Manager Console to scaffold a new migration and apply it to the database:", body); } } }