Fix test websites

This commit is contained in:
Hao Kung 2015-09-02 20:11:05 -07:00
parent 77d9b41e48
commit 6333c12d77
5 changed files with 8 additions and 10 deletions

View File

@ -56,7 +56,7 @@ namespace ContentNegotiationWebSite
var optionsAccessor = ActionContext.HttpContext.RequestServices
.GetRequiredService<IOptions<MvcOptions>>();
objectResult.Formatters.Add(new HttpNotAcceptableOutputFormatter());
foreach (var formatter in optionsAccessor.Options.OutputFormatters)
foreach (var formatter in optionsAccessor.Value.OutputFormatters)
{
objectResult.Formatters.Add(formatter);
}
@ -74,7 +74,7 @@ namespace ContentNegotiationWebSite
objectResult.Formatters.Add(new HttpNotAcceptableOutputFormatter());
}
foreach (var formatter in optionsAccessor.Options.OutputFormatters)
foreach (var formatter in optionsAccessor.Value.OutputFormatters)
{
objectResult.Formatters.Add(formatter);
}

View File

@ -18,7 +18,7 @@ namespace FiltersWebSite
IUrlEncoder encoder,
string authScheme) :
base(next, options, loggerFactory, encoder,
new ConfigureOptions<BasicOptions>(o => o.AuthenticationScheme = authScheme) { Name = authScheme })
new ConfigureOptions<BasicOptions>(o => o.AuthenticationScheme = authScheme))
{
}

View File

@ -15,7 +15,7 @@ namespace FiltersWebSite
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.ConfigureAuthorization(options =>
services.AddAuthorization(options =>
{
// This policy cannot succeed since the claim is never added
options.AddPolicy("Impossible", policy =>
@ -43,8 +43,6 @@ namespace FiltersWebSite
services.AddSingleton<RandomNumberFilter>();
services.AddSingleton<RandomNumberService>();
services.AddTransient<IAuthorizationHandler, ManagerHandler>();
services.Configure<BasicOptions>(o => o.AuthenticationScheme = "Api", "Api");
services.Configure<BasicOptions>(o => o.AuthenticationScheme = "Interactive", "Interactive");
services.Configure<MvcOptions>(options =>
{

View File

@ -37,12 +37,12 @@ namespace UrlHelperWebSite
/// <returns></returns>
public override string Content(string contentPath)
{
if (_appOptions.Options.ServeCDNContent
if (_appOptions.Value.ServeCDNContent
&& contentPath.StartsWith("~/", StringComparison.Ordinal))
{
var segment = new PathString(contentPath.Substring(1));
return ConvertToLowercaseUrl(_appOptions.Options.CDNServerBaseUrl + segment);
return ConvertToLowercaseUrl(_appOptions.Value.CDNServerBaseUrl + segment);
}
return ConvertToLowercaseUrl(base.Content(contentPath));
@ -61,7 +61,7 @@ namespace UrlHelperWebSite
private string ConvertToLowercaseUrl(string url)
{
if (!string.IsNullOrEmpty(url)
&& _appOptions.Options.GenerateLowercaseUrls)
&& _appOptions.Value.GenerateLowercaseUrls)
{
return url.ToLowerInvariant();
}

View File

@ -46,7 +46,7 @@ namespace WebApiCompatShimWebSite
[HttpGet]
public string[] GetFormatters()
{
return OptionsAccessor.Options.Formatters.Select(f => f.GetType().FullName).ToArray();
return OptionsAccessor.Value.Formatters.Select(f => f.GetType().FullName).ToArray();
}
[HttpGet]