React to DNX changes

This commit is contained in:
David Fowler 2015-10-23 02:46:29 -07:00
parent cd8252bd55
commit e89840bac8
3 changed files with 5 additions and 11 deletions

View File

@ -5,7 +5,6 @@ using Microsoft.Data.Entity;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Dnx.Runtime;
#if DNX451 #if DNX451
using NLog.Config; using NLog.Config;
using NLog.Targets; using NLog.Targets;
@ -15,14 +14,13 @@ namespace IdentitySamples
{ {
public partial class Startup public partial class Startup
{ {
public Startup(IApplicationEnvironment env) public Startup()
{ {
/* /*
* Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources, * Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1' is found in both the registered sources,
* then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely. * then the later source will win. By this way a Local config can be overridden by a different setting while deployed remotely.
*/ */
var builder = new ConfigurationBuilder() var builder = new ConfigurationBuilder()
.SetBasePath(env.ApplicationBasePath)
.AddJsonFile("LocalConfig.json") .AddJsonFile("LocalConfig.json")
.AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values. .AddEnvironmentVariables(); //All environment variables in the process's context flow in as configuration values.

View File

@ -9,7 +9,6 @@ using Microsoft.AspNet.Builder.Internal;
using Microsoft.AspNet.Identity.Test; using Microsoft.AspNet.Identity.Test;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Dnx.Runtime.Infrastructure;
using Xunit; using Xunit;
using Microsoft.AspNet.Testing.xunit; using Microsoft.AspNet.Testing.xunit;
@ -54,8 +53,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
private ApplicationBuilder CreateBuilder() private ApplicationBuilder CreateBuilder()
{ {
var builder = new ApplicationBuilder(CallContextServiceLocator.Locator.ServiceProvider); var builder = new ApplicationBuilder(ConfigureServices());
builder.ApplicationServices = ConfigureServices();
return builder; return builder;
} }

View File

@ -11,7 +11,6 @@ using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Authentication; using Microsoft.AspNet.Http.Authentication;
using Microsoft.AspNet.Identity.Test; using Microsoft.AspNet.Identity.Test;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Dnx.Runtime.Infrastructure;
using Moq; using Moq;
using Xunit; using Xunit;
@ -24,9 +23,6 @@ namespace Microsoft.AspNet.Identity.InMemory.Test
[InlineData(false)] [InlineData(false)]
public async Task VerifyAccountControllerSignIn(bool isPersistent) public async Task VerifyAccountControllerSignIn(bool isPersistent)
{ {
var app = new ApplicationBuilder(CallContextServiceLocator.Locator.ServiceProvider);
app.UseCookieAuthentication();
var context = new Mock<HttpContext>(); var context = new Mock<HttpContext>();
var auth = new Mock<AuthenticationManager>(); var auth = new Mock<AuthenticationManager>();
context.Setup(c => c.Authentication).Returns(auth.Object).Verifiable(); context.Setup(c => c.Authentication).Returns(auth.Object).Verifiable();
@ -43,7 +39,9 @@ namespace Microsoft.AspNet.Identity.InMemory.Test
services.AddIdentity<TestUser, TestRole>(); services.AddIdentity<TestUser, TestRole>();
services.AddSingleton<IUserStore<TestUser>, InMemoryUserStore<TestUser>>(); services.AddSingleton<IUserStore<TestUser>, InMemoryUserStore<TestUser>>();
services.AddSingleton<IRoleStore<TestRole>, InMemoryRoleStore<TestRole>>(); services.AddSingleton<IRoleStore<TestRole>, InMemoryRoleStore<TestRole>>();
app.ApplicationServices = services.BuildServiceProvider();
var app = new ApplicationBuilder(services.BuildServiceProvider());
app.UseCookieAuthentication();
// Act // Act
var user = new TestUser var user = new TestUser