Fixed failing tests by adding an ILoggerFactory

This commit is contained in:
David Fowler 2014-10-07 01:16:11 -07:00
parent 20d096d865
commit 665780b18f
5 changed files with 38 additions and 18 deletions

View File

@ -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<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer();
services.SetupOptions<DbContextOptions>(options => options.UseSqlServer(ConnectionString));
var serviceProvider = services.BuildServiceProvider();

View File

@ -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<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer();
services.SetupOptions<DbContextOptions>(options => options.UseSqlServer(ConnectionString));
var serviceProvider = services.BuildServiceProvider();

View File

@ -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<ILoggerFactory>(new NullLoggerFactory());
services.SetupOptions<DbContextOptions>(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<ILoggerFactory>(new NullLoggerFactory());
services.SetupOptions<DbContextOptions>(options =>
options.UseSqlServer(ConnectionString));
var serviceProvider = services.BuildServiceProvider();
@ -111,6 +115,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test
builder.UseServices(services =>
{
services.AddInstance<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer();
services.AddIdentitySqlServer<ApplicationDbContext, TUser, TRole, TKey>();
services.SetupOptions<DbContextOptions>(options =>
@ -138,6 +143,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test
builder.UseServices(services =>
{
services.AddInstance<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer();
services.AddIdentitySqlServer<ApplicationDbContext, TUser, TRole, TKey>().SetupOptions(options =>
{

View File

@ -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<ILoggerFactory>(new NullLoggerFactory());
services.AddIdentity<GuidUser, GuidRole>().AddRoleStore(new ApplicationRoleStore((ApplicationDbContext)context));
return services.BuildServiceProvider().GetService<RoleManager<GuidRole>>();
}

View File

@ -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<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer();
services.Add(OptionsServices.GetDefaultServices());
services.SetupOptions<DbContextOptions>(options =>
@ -65,6 +65,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test
builder.UseServices(services =>
{
services.AddInstance<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer();
services.AddIdentitySqlServer<ApplicationDbContext, ApplicationUser>();
services.SetupOptions<DbContextOptions>(options =>
@ -92,6 +93,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test
builder.UseServices(services =>
{
services.AddInstance<ILoggerFactory>(new NullLoggerFactory());
services.AddEntityFramework().AddSqlServer();
services.AddIdentitySqlServer<ApplicationDbContext, ApplicationUser>().SetupOptions(options =>
{
@ -134,6 +136,7 @@ namespace Microsoft.AspNet.Identity.SqlServer.Test
public IdentityDbContext CreateContext(bool delete = false)
{
var services = new ServiceCollection();
services.AddInstance<ILoggerFactory>(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<ILoggerFactory>(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<IdentityRole> CreateRoleManager(IdentityDbContext context)
{
var services = new ServiceCollection();
services.AddInstance<ILoggerFactory>(new NullLoggerFactory());
services.AddIdentity().AddRoleStore(new RoleStore<IdentityRole>(context));
return services.BuildServiceProvider().GetService<RoleManager<IdentityRole>>();
}