// 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.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.Framework.DependencyInjection; using RazorWebSite; using Xunit; namespace Microsoft.AspNet.Mvc.FunctionalTests { public class HtmlHelperOptionsTest { private const string SiteName = nameof(RazorWebSite); private readonly Action _app = new Startup().Configure; private readonly Action _configureServices = new Startup().ConfigureServices; [Fact] public async Task AppWideDefaultsInViewAndPartialView() { // Arrange var expected = @"
MySummary
An error occurred.
MySummary
An error occurred.
False"; var server = TestHelper.CreateServer(_app, SiteName, _configureServices); var client = server.CreateClient(); // Act var body = await client.GetStringAsync("http://localhost/HtmlHelperOptions/HtmlHelperOptionsDefaultsInView"); // Assert Assert.Equal(expected, body.Trim()); } [Fact] public async Task OverrideAppWideDefaultsInViewAndPartialView() { // Arrange var expected = @"
MySummary
An error occurred.
True
MySummary
An error occurred.
True"; var server = TestHelper.CreateServer(_app, SiteName, _configureServices); var client = server.CreateClient(); // Act var body = await client.GetStringAsync("http://localhost/HtmlHelperOptions/OverrideAppWideDefaultsInView"); // Assert Assert.Equal(expected, body.Trim()); } } }