public static ITokenServiceDbContext GetTokenServiceDbContext() { var options = new DbContextOptionsBuilder <Infrastructure.Models.OAuthContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new Infrastructure.Models.OAuthContext(options); context.Database.EnsureCreated(); return(context); }
public void Setup() { Guid userId = Guid.Parse("71264886-e911-4f71-a9f7-e850967122fd"); Guid clientId = Guid.Parse("29bfd4b1-81c0-4db3-a615-4422d08f9792"); configuration = TestHelper.GetIConfigurationRoot(TestContext.CurrentContext.TestDirectory); var options = new DbContextOptionsBuilder <Infrastructure.Models.OAuthContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; context = new Infrastructure.Models.OAuthContext(options); context.User.Add(new User { UserId = userId, UserName = "******", Salt = "pgsoAvSXD3xYPV+/pSAe3khYZWOFidHPxpltwNDP4Xw=", HashPassword = "******" }); context.Authorize.Add(new Authorize { Client_Id = clientId, Code = "pgsoAvSXD3xYPV+/pSAe3khYZWOFidHPxpltwNDP4Xw=", UserId = userId, Scope = "photos", ID = 0 }); context.SaveChanges(); }