private static void InitializeDbForTests(IServiceScope serviceScope)
        {
            ShareThingsDbContext context = serviceScope.ServiceProvider.GetService <ShareThingsDbContext>();

            if (!context.Users.Any())
            {
                context.Users.Add(new User(IdentitySingleton.Instance.GetBorrower().Id));
                context.Users.Add(new User(IdentitySingleton.Instance.GetLender().Id));

                context.SaveChanges();
            }

            ShareThingsIdentityContext contextIdentity = serviceScope.ServiceProvider.GetService <ShareThingsIdentityContext>();

            if (!contextIdentity.Users.Any())
            {
                contextIdentity.Users.Add(IdentitySingleton.Instance.GetBorrower());
                contextIdentity.Users.Add(IdentitySingleton.Instance.GetLender());

                contextIdentity.SaveChanges();
            }
        }
Example #2
0
 public ShareThingUserStore(ShareThingsIdentityContext context, ShareThingsDbContext dbContext)
 {
     _context   = context;
     _dbContext = dbContext;
 }