public UserTestBase(InMemoryDatabaseTypes type) { var factory = new ContextFactory(); var context = factory.CreateContext(); switch (type) { case InMemoryDatabaseTypes.USER_ROLE: SeedFilePath = "path-to-user-role-seed"; InMemoryDatabaseContext = SeedContext(context); break; case InMemoryDatabaseTypes.USER: SeedFilePath = "path-to-user-seed"; InMemoryDatabaseContext = SeedContext(context); break; case InMemoryDatabaseTypes.CLEAN: // No seeding neccessary InMemoryDatabaseContext = context; break; default: InMemoryDatabaseContext = context; break; } //var configuration = new MapperConfiguration(cfg => new IdentityEntitiesToModelsMappingProfile()); var config = new MapperConfiguration(cfg => { cfg.AddProfile <IdentityEntitiesToModelsMappingProfile>(); cfg.AddProfile <ViewModelToEntityMappingProfile>(); }); Mapper = config.CreateMapper(); UnitOfWork = new UnitOfWork(InMemoryDatabaseContext); var roleStore = new RoleStore(UnitOfWork, Mapper); UserStore = new UserStore(new IdentityErrorDescriber(), UnitOfWork, roleStore, new UserStoreHelper(Mapper), Mapper); //Initialize the users list Users = new List <ApplicationUser> { new ApplicationUser { GivenName = "Ola", Email = "*****@*****.**", PasswordHash = "jh7asd6am" } }; }
public UserTestBase(InMemoryDatabaseTypes type) { switch (type) { case InMemoryDatabaseTypes.USER_ROLE: InMemoryDatabaseContext = StorageBuilder.GetInMemContextUserAndRoleData(); break; case InMemoryDatabaseTypes.USER: break; case InMemoryDatabaseTypes.CLEAN: InMemoryDatabaseContext = StorageBuilder.GetInMemContext(); break; default: InMemoryDatabaseContext = StorageBuilder.GetInMemContext(); break; } UnitOfWork = (UnitOfWork)StorageBuilder.GetUnitOfWork(InMemoryDatabaseContext); //var configuration = new MapperConfiguration(cfg => new IdentityEntitiesToModelsMappingProfile()); var config = new MapperConfiguration(cfg => { cfg.AddProfile <IdentityEntitiesToModelsMappingProfile>(); cfg.AddProfile <ViewModelToEntityMappingProfile>(); }); Mapper = config.CreateMapper(); var roleStore = new RoleStore(UnitOfWork, Mapper); UserStore = new UserStore(UnitOfWork, roleStore, Mapper); //Initialize the users list Users = new List <ApplicationUser> { new ApplicationUser { GivenName = "Ola", Email = "*****@*****.**", PasswordHash = "jh7asd6am" } }; }