From 665780b18faf418a88dfd7be7117de5ce96195ba Mon Sep 17 00:00:00 2001 From: David Fowler Date: Tue, 7 Oct 2014 01:16:11 -0700 Subject: [PATCH] Fixed failing tests by adding an ILoggerFactory --- .../CustomPocoTest.cs | 3 +++ .../DefaultPocoTest.cs | 7 ++++-- .../SqlStoreTestBase.cs | 18 ++++++++++----- .../UserStoreGuidKeyTest.cs | 5 +++- .../UserStoreTest.cs | 23 +++++++++++-------- 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/test/Microsoft.AspNet.Identity.SqlServer.Test/CustomPocoTest.cs b/test/Microsoft.AspNet.Identity.SqlServer.Test/CustomPocoTest.cs index fabe351144..4109876bd1 100644 --- a/test/Microsoft.AspNet.Identity.SqlServer.Test/CustomPocoTest.cs +++ b/test/Microsoft.AspNet.Identity.SqlServer.Test/CustomPocoTest.cs @@ -8,8 +8,10 @@ using JetBrains.Annotations; using Microsoft.AspNet.Identity.Test; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Metadata; +using Microsoft.Data.Entity.Services; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection.Fallback; +using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; using Xunit; @@ -48,6 +50,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test { var services = new ServiceCollection(); services.Add(OptionsServices.GetDefaultServices()); + services.AddInstance(new NullLoggerFactory()); services.AddEntityFramework().AddSqlServer(); services.SetupOptions(options => options.UseSqlServer(ConnectionString)); var serviceProvider = services.BuildServiceProvider(); diff --git a/test/Microsoft.AspNet.Identity.SqlServer.Test/DefaultPocoTest.cs b/test/Microsoft.AspNet.Identity.SqlServer.Test/DefaultPocoTest.cs index 465b2edede..37a439534b 100644 --- a/test/Microsoft.AspNet.Identity.SqlServer.Test/DefaultPocoTest.cs +++ b/test/Microsoft.AspNet.Identity.SqlServer.Test/DefaultPocoTest.cs @@ -1,14 +1,16 @@ // 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.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Identity.Test; using Microsoft.Data.Entity; +using Microsoft.Data.Entity.Services; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection.Fallback; +using Microsoft.Framework.Logging; using Microsoft.Framework.OptionsModel; -using System; -using System.Threading.Tasks; using Xunit; namespace Microsoft.AspNet.Identity.SqlServer.Test @@ -21,6 +23,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test { var services = new ServiceCollection(); services.Add(OptionsServices.GetDefaultServices()); + services.AddInstance(new NullLoggerFactory()); services.AddEntityFramework().AddSqlServer(); services.SetupOptions(options => options.UseSqlServer(ConnectionString)); var serviceProvider = services.BuildServiceProvider(); diff --git a/test/Microsoft.AspNet.Identity.SqlServer.Test/SqlStoreTestBase.cs b/test/Microsoft.AspNet.Identity.SqlServer.Test/SqlStoreTestBase.cs index cdab3b7037..f6d6d76bb1 100644 --- a/test/Microsoft.AspNet.Identity.SqlServer.Test/SqlStoreTestBase.cs +++ b/test/Microsoft.AspNet.Identity.SqlServer.Test/SqlStoreTestBase.cs @@ -1,16 +1,18 @@ // 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 Microsoft.AspNet.Builder; -using Microsoft.AspNet.Identity.Test; -using Microsoft.Data.Entity; -using Microsoft.Framework.DependencyInjection; -using Microsoft.Framework.DependencyInjection.Fallback; -using Microsoft.Framework.OptionsModel; using System; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; +using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Identity.Test; +using Microsoft.Data.Entity; +using Microsoft.Data.Entity.Services; +using Microsoft.Framework.DependencyInjection; +using Microsoft.Framework.DependencyInjection.Fallback; +using Microsoft.Framework.Logging; +using Microsoft.Framework.OptionsModel; using Xunit; namespace Microsoft.AspNet.Identity.SqlServer.Test @@ -47,6 +49,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test var services = new ServiceCollection(); services.AddEntityFramework().AddSqlServer(); services.Add(OptionsServices.GetDefaultServices()); + services.AddInstance(new NullLoggerFactory()); services.SetupOptions(options => options.UseSqlServer(ConnectionString)); var serviceProvider = services.BuildServiceProvider(); @@ -60,6 +63,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test var services = new ServiceCollection(); services.AddEntityFramework().AddSqlServer(); services.Add(OptionsServices.GetDefaultServices()); + services.AddInstance(new NullLoggerFactory()); services.SetupOptions(options => options.UseSqlServer(ConnectionString)); var serviceProvider = services.BuildServiceProvider(); @@ -111,6 +115,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test builder.UseServices(services => { + services.AddInstance(new NullLoggerFactory()); services.AddEntityFramework().AddSqlServer(); services.AddIdentitySqlServer(); services.SetupOptions(options => @@ -138,6 +143,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test builder.UseServices(services => { + services.AddInstance(new NullLoggerFactory()); services.AddEntityFramework().AddSqlServer(); services.AddIdentitySqlServer().SetupOptions(options => { diff --git a/test/Microsoft.AspNet.Identity.SqlServer.Test/UserStoreGuidKeyTest.cs b/test/Microsoft.AspNet.Identity.SqlServer.Test/UserStoreGuidKeyTest.cs index 04a591f4b6..eba062f417 100644 --- a/test/Microsoft.AspNet.Identity.SqlServer.Test/UserStoreGuidKeyTest.cs +++ b/test/Microsoft.AspNet.Identity.SqlServer.Test/UserStoreGuidKeyTest.cs @@ -1,10 +1,12 @@ // 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.Identity.Test; +using Microsoft.Data.Entity.Services; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection.Fallback; -using System; +using Microsoft.Framework.Logging; using Xunit; namespace Microsoft.AspNet.Identity.SqlServer.Test @@ -76,6 +78,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test context = CreateTestContext(); } var services = new ServiceCollection(); + services.AddInstance(new NullLoggerFactory()); services.AddIdentity().AddRoleStore(new ApplicationRoleStore((ApplicationDbContext)context)); return services.BuildServiceProvider().GetService>(); } diff --git a/test/Microsoft.AspNet.Identity.SqlServer.Test/UserStoreTest.cs b/test/Microsoft.AspNet.Identity.SqlServer.Test/UserStoreTest.cs index b1f0bbf1bb..4617950091 100644 --- a/test/Microsoft.AspNet.Identity.SqlServer.Test/UserStoreTest.cs +++ b/test/Microsoft.AspNet.Identity.SqlServer.Test/UserStoreTest.cs @@ -1,19 +1,18 @@ // 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 Microsoft.AspNet.Builder; -using Microsoft.AspNet.Identity.Test; -using Microsoft.AspNet.Testing; -using Microsoft.Data.Entity; -using Microsoft.Framework.DependencyInjection; -using Microsoft.Framework.DependencyInjection.Fallback; -using Microsoft.Framework.OptionsModel; using System; -using System.Collections.Generic; using System.Linq; using System.Security.Claims; -using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Identity.Test; +using Microsoft.Data.Entity; +using Microsoft.Data.Entity.Services; +using Microsoft.Framework.DependencyInjection; +using Microsoft.Framework.DependencyInjection.Fallback; +using Microsoft.Framework.Logging; +using Microsoft.Framework.OptionsModel; using Xunit; namespace Microsoft.AspNet.Identity.SqlServer.Test @@ -47,6 +46,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test public void DropDb() { var services = new ServiceCollection(); + services.AddInstance(new NullLoggerFactory()); services.AddEntityFramework().AddSqlServer(); services.Add(OptionsServices.GetDefaultServices()); services.SetupOptions(options => @@ -65,6 +65,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test builder.UseServices(services => { + services.AddInstance(new NullLoggerFactory()); services.AddEntityFramework().AddSqlServer(); services.AddIdentitySqlServer(); services.SetupOptions(options => @@ -92,6 +93,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test builder.UseServices(services => { + services.AddInstance(new NullLoggerFactory()); services.AddEntityFramework().AddSqlServer(); services.AddIdentitySqlServer().SetupOptions(options => { @@ -134,6 +136,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test public IdentityDbContext CreateContext(bool delete = false) { var services = new ServiceCollection(); + services.AddInstance(new NullLoggerFactory()); services.AddEntityFramework().AddSqlServer(); var dbOptions = new DbContextOptions(); dbOptions.UseSqlServer(ConnectionString); @@ -161,6 +164,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test { CreateContext(); var services = new ServiceCollection(); + services.AddInstance(new NullLoggerFactory()); services.AddEntityFramework().AddSqlServer(); services.Add(OptionsServices.GetDefaultServices()); var serviceProvider = services.BuildServiceProvider(); @@ -187,6 +191,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test public static RoleManager CreateRoleManager(IdentityDbContext context) { var services = new ServiceCollection(); + services.AddInstance(new NullLoggerFactory()); services.AddIdentity().AddRoleStore(new RoleStore(context)); return services.BuildServiceProvider().GetService>(); }