// 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; using System.Net; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.Framework.DependencyInjection; using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { public class BestEffortLinkGenerationTest { private const string SiteName = nameof(BestEffortLinkGenerationWebSite); private readonly Action _app = new BestEffortLinkGenerationWebSite.Startup().Configure; private readonly Action _configureServices = new BestEffortLinkGenerationWebSite.Startup().ConfigureServices; private const string ExpectedOutput = @" About Us "; [Fact] public async Task GenerateLink_NonExistentAction() { // Arrange var server = TestHelper.CreateServer(_app, SiteName, _configureServices); var client = server.CreateClient(); var url = "http://localhost/Home/Index"; // Act var response = await client.GetAsync(url); var content = await response.Content.ReadAsStringAsync(); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(ExpectedOutput, content); } } }