Register DataProtection Services in tests

This commit is contained in:
Suhas Joshi 2014-11-18 15:49:34 -08:00
parent 42c809ca16
commit 0e9fa31da5
3 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,7 @@ using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Identity.Test;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.DependencyInjection.Fallback;
using Microsoft.AspNet.Security.DataProtection;
using Xunit;
namespace Microsoft.AspNet.Identity.EntityFramework.Test
@ -48,6 +49,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
{
DbUtil.ConfigureDbServices<IdentityDbContext>(ConnectionString, services);
services.AddDefaultIdentity<IdentityDbContext, IdentityUser, IdentityRole>();
services.Add(DataProtectionServices.GetDefaultServices());
});
var userStore = builder.ApplicationServices.GetRequiredService<IUserStore<IdentityUser>>();

View File

@ -12,6 +12,7 @@ using Microsoft.Data.Entity;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.DependencyInjection.Fallback;
using Microsoft.Framework.Logging;
using Microsoft.AspNet.Security.DataProtection;
using Xunit;
namespace Microsoft.AspNet.Identity.EntityFramework.Test
@ -53,6 +54,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
{
DbUtil.ConfigureDbServices<ApplicationDbContext>(ConnectionString, services);
services.AddDefaultIdentity<ApplicationDbContext, ApplicationUser, IdentityRole>();
services.Add(DataProtectionServices.GetDefaultServices());
});
var userStore = builder.ApplicationServices.GetRequiredService<IUserStore<ApplicationUser>>();

View File

@ -32,6 +32,7 @@ namespace Microsoft.AspNet.Identity.Test
{
services.Add(OptionsServices.GetDefaultServices());
services.Add(HostingServices.GetDefaultServices());
services.Add(DataProtectionServices.GetDefaultServices());
services.AddDefaultIdentity<TUser, TRole>();
AddUserStore(services, context);
AddRoleStore(services, context);