Fixing compilation issue with EntiryFramework

This commit is contained in:
Pranav K 2014-10-17 07:30:14 -07:00
parent ee6d0cbd6d
commit 4033ea95c6
4 changed files with 4 additions and 16 deletions

View File

@ -4,15 +4,9 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.AspNet.Identity.Test; using Microsoft.AspNet.Identity.Test;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Metadata; 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; using Xunit;
namespace Microsoft.AspNet.Identity.EntityFramework.Test namespace Microsoft.AspNet.Identity.EntityFramework.Test

View File

@ -3,7 +3,6 @@
using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Hosting;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Services;
using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.DependencyInjection.Fallback; using Microsoft.Framework.DependencyInjection.Fallback;
using Microsoft.Framework.Logging; using Microsoft.Framework.Logging;
@ -29,7 +28,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
services.Add(HostingServices.GetDefaultServices()); services.Add(HostingServices.GetDefaultServices());
services.AddEntityFramework().AddSqlServer().AddDbContext<TContext>(options => options.UseSqlServer(connectionString)); services.AddEntityFramework().AddSqlServer().AddDbContext<TContext>(options => options.UseSqlServer(connectionString));
services.Add(OptionsServices.GetDefaultServices()); services.Add(OptionsServices.GetDefaultServices());
services.AddInstance<ILoggerFactory>(new NullLoggerFactory()); services.AddInstance<ILoggerFactory>(new LoggerFactory());
return services; return services;
} }

View File

@ -5,12 +5,8 @@ using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Builder; using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Identity.Test; using Microsoft.AspNet.Identity.Test;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Services;
using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.DependencyInjection.Fallback; using Microsoft.Framework.DependencyInjection.Fallback;
using Microsoft.Framework.Logging;
using Microsoft.Framework.OptionsModel;
using Xunit; using Xunit;
namespace Microsoft.AspNet.Identity.EntityFramework.Test namespace Microsoft.AspNet.Identity.EntityFramework.Test

View File

@ -9,7 +9,6 @@ using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Identity.Test; using Microsoft.AspNet.Identity.Test;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Services;
using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.DependencyInjection.Fallback; using Microsoft.Framework.DependencyInjection.Fallback;
using Microsoft.Framework.Logging; using Microsoft.Framework.Logging;
@ -77,7 +76,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
builder.UseServices(services => builder.UseServices(services =>
{ {
services.AddInstance<ILoggerFactory>(new NullLoggerFactory()); services.AddInstance<ILoggerFactory>(new LoggerFactory());
services.Add(HostingServices.GetDefaultServices()); services.Add(HostingServices.GetDefaultServices());
services.AddEntityFramework() services.AddEntityFramework()
.AddSqlServer() .AddSqlServer()
@ -111,7 +110,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
using (var db = CreateContext()) using (var db = CreateContext())
{ {
var guid = Guid.NewGuid().ToString(); var guid = Guid.NewGuid().ToString();
db.Users.Add(new IdentityUser {Id = guid, UserName = guid}); db.Users.Add(new IdentityUser { Id = guid, UserName = guid });
db.SaveChanges(); db.SaveChanges();
Assert.True(db.Users.Any(u => u.UserName == guid)); Assert.True(db.Users.Any(u => u.UserName == guid));
Assert.NotNull(db.Users.FirstOrDefault(u => u.UserName == guid)); Assert.NotNull(db.Users.FirstOrDefault(u => u.UserName == guid));
@ -278,7 +277,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework.Test
{ {
var manager = CreateManager(); var manager = CreateManager();
var guid = Guid.NewGuid().ToString(); var guid = Guid.NewGuid().ToString();
var user = new IdentityUser { UserName = "New"+guid }; var user = new IdentityUser { UserName = "New" + guid };
IdentityResultAssert.IsSuccess(await manager.CreateAsync(user)); IdentityResultAssert.IsSuccess(await manager.CreateAsync(user));
IdentityResultAssert.IsSuccess(await manager.DeleteAsync(user)); IdentityResultAssert.IsSuccess(await manager.DeleteAsync(user));
} }