// 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.Collections.Generic; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Microsoft.Extensions.Options.Infrastructure; using Xunit; namespace Microsoft.AspNetCore.Authentication { public class ConfigTests { [Fact] public void AddCanBindAgainstDefaultConfig() { var dic = new Dictionary { {"Microsoft:AspNetCore:Authentication:DefaultSignInScheme", ""}, {"Microsoft:AspNetCore:Authentication:DefaultAuthenticateScheme", ""}, {"Microsoft:AspNetCore:Authentication:DefaultChallengeScheme", ""} }; var configurationBuilder = new ConfigurationBuilder(); configurationBuilder.AddInMemoryCollection(dic); var config = configurationBuilder.Build(); var services = new ServiceCollection() .AddOptions() .AddSingleton, ConfigureDefaults>() .AddAuthenticationCore() .AddSingleton(config); var sp = services.BuildServiceProvider(); var options = sp.GetRequiredService>().Value; Assert.Equal("", options.DefaultAuthenticateScheme); Assert.Equal("", options.DefaultChallengeScheme); Assert.Equal("", options.DefaultSignInScheme); } } }