diff --git a/test/Microsoft.AspNet.Security.Test/Cookies/CookieMiddlewareTests.cs b/test/Microsoft.AspNet.Security.Test/Cookies/CookieMiddlewareTests.cs index fc101faaa5..dbf470f839 100644 --- a/test/Microsoft.AspNet.Security.Test/Cookies/CookieMiddlewareTests.cs +++ b/test/Microsoft.AspNet.Security.Test/Cookies/CookieMiddlewareTests.cs @@ -18,8 +18,6 @@ using Microsoft.AspNet.Http.Security; using Microsoft.AspNet.TestHost; using Shouldly; using Xunit; -using Microsoft.Framework.OptionsModel; -using Microsoft.Framework.DependencyInjection; namespace Microsoft.AspNet.Security.Cookies { @@ -367,7 +365,7 @@ namespace Microsoft.AspNet.Security.Cookies private static TestServer CreateServer(Action configureOptions, Func testpath = null) { - return TestServer.Create(app => + return TestServer.Create(TestServices.CreateTestServices(), app => { app.UseCookieAuthentication(configureOptions); app.Use(async (context, next) => diff --git a/test/Microsoft.AspNet.Security.Test/Facebook/FacebookMiddlewareTests.cs b/test/Microsoft.AspNet.Security.Test/Facebook/FacebookMiddlewareTests.cs index 6120b82c44..08c5e1ed43 100644 --- a/test/Microsoft.AspNet.Security.Test/Facebook/FacebookMiddlewareTests.cs +++ b/test/Microsoft.AspNet.Security.Test/Facebook/FacebookMiddlewareTests.cs @@ -107,7 +107,7 @@ namespace Microsoft.AspNet.Security.Facebook private static TestServer CreateServer(Action configure, Func handler) { - return TestServer.Create(app => + return TestServer.Create(TestServices.CreateTestServices(), app => { if (configure != null) { diff --git a/test/Microsoft.AspNet.Security.Test/Google/GoogleMiddlewareTests.cs b/test/Microsoft.AspNet.Security.Test/Google/GoogleMiddlewareTests.cs index 3a1113d7f8..b6945d4c5e 100644 --- a/test/Microsoft.AspNet.Security.Test/Google/GoogleMiddlewareTests.cs +++ b/test/Microsoft.AspNet.Security.Test/Google/GoogleMiddlewareTests.cs @@ -463,7 +463,7 @@ namespace Microsoft.AspNet.Security.Google private static TestServer CreateServer(Action configureOptions, Func testpath = null) { - return TestServer.Create(app => + return TestServer.Create(TestServices.CreateTestServices(), app => { app.UseServices(services => { diff --git a/test/Microsoft.AspNet.Security.Test/MicrosoftAccount/MicrosoftAccountMiddlewareTests.cs b/test/Microsoft.AspNet.Security.Test/MicrosoftAccount/MicrosoftAccountMiddlewareTests.cs index d055df748c..5b01da6c09 100644 --- a/test/Microsoft.AspNet.Security.Test/MicrosoftAccount/MicrosoftAccountMiddlewareTests.cs +++ b/test/Microsoft.AspNet.Security.Test/MicrosoftAccount/MicrosoftAccountMiddlewareTests.cs @@ -161,7 +161,7 @@ namespace Microsoft.AspNet.Security.Tests.MicrosoftAccount private static TestServer CreateServer(Action configureOptions, Func handler) { - return TestServer.Create(app => + return TestServer.Create(TestServices.CreateTestServices(), app => { app.UseServices(services => { diff --git a/test/Microsoft.AspNet.Security.Test/TestApplicationEnvironment.cs b/test/Microsoft.AspNet.Security.Test/TestApplicationEnvironment.cs new file mode 100644 index 0000000000..01ef364c1d --- /dev/null +++ b/test/Microsoft.AspNet.Security.Test/TestApplicationEnvironment.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Open Technologies, Inc. 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.Runtime.Versioning; +using Microsoft.Framework.Runtime; + +namespace Microsoft.AspNet.Security +{ + public class TestApplicationEnvironment : IApplicationEnvironment + { + public string ApplicationBasePath + { + get { return Environment.CurrentDirectory; } + } + + public string ApplicationName + { + get { return "Test App environment"; } + } + + public string Configuration + { + get { return "Test"; } + } + + public FrameworkName RuntimeFramework + { + get { return new FrameworkName(".NETFramework", new Version(4, 5)); } + } + + public string Version + { + get { return "1.0.0"; } + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Security.Test/TestServices.cs b/test/Microsoft.AspNet.Security.Test/TestServices.cs new file mode 100644 index 0000000000..ea3b392ce7 --- /dev/null +++ b/test/Microsoft.AspNet.Security.Test/TestServices.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.AspNet.Security.DataProtection; +using Microsoft.Framework.DependencyInjection; +using Microsoft.Framework.DependencyInjection.Fallback; +using Microsoft.Framework.Runtime; + +namespace Microsoft.AspNet.Security +{ + public static class TestServices + { + public static IServiceProvider CreateTestServices() + { + var collection = new ServiceCollection(); + collection.AddSingleton(); + collection.Add(DataProtectionServices.GetDefaultServices()); + return collection.BuildServiceProvider(); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Security.Test/Twitter/TwitterMiddlewareTests.cs b/test/Microsoft.AspNet.Security.Test/Twitter/TwitterMiddlewareTests.cs index 5505f97542..ab24c00747 100644 --- a/test/Microsoft.AspNet.Security.Test/Twitter/TwitterMiddlewareTests.cs +++ b/test/Microsoft.AspNet.Security.Test/Twitter/TwitterMiddlewareTests.cs @@ -107,7 +107,7 @@ namespace Microsoft.AspNet.Security.Twitter private static TestServer CreateServer(Action configure, Func handler) { - return TestServer.Create(app => + return TestServer.Create(TestServices.CreateTestServices(), app => { app.UseServices(services => {