コード例 #1
0
        public RoleTestBase()
        {
            //Context = StorageBuilder.GetContext();
            //UnitOfWork = (UnitOfWork)StorageBuilder.GetUnitOfWork(Context);
            InMemoryDatabaseContext = StorageBuilder.GetInMemContextUserAndRoleData();
            UnitOfWork = (UnitOfWork)StorageBuilder.GetUnitOfWork(InMemoryDatabaseContext);
            var configuration = new MapperConfiguration(cfg => cfg.AddProfile <IdentityEntitiesToModelsMappingProfile>());
            //var configuration = new MapperConfiguration(cfg => new IdentityEntitiesToModelsMappingProfile());
            var mapper = configuration.CreateMapper();

            RoleStore = new RoleStore(UnitOfWork, mapper);
        }
コード例 #2
0
        public HardCodedBase()
        {
            // Using real database
            //var RealDatabaseContext = StorageBuilder.GetContext();
            //UnitOfWork = (UnitOfWork)StorageBuilder.GetUnitOfWork(RealDatabaseContext);
            //DatabaseContext = RealDatabaseContext;

            // Using in-memory database
            var InMemoryDatabaseContext = StorageBuilder.GetInMemContextWithRoleData();

            DatabaseContext = InMemoryDatabaseContext;
            UnitOfWork      = (UnitOfWork)StorageBuilder.GetUnitOfWork(InMemoryDatabaseContext);

            // Configure auto-mapper
            var configuration = new MapperConfiguration(cfg => cfg.AddProfile <IdentityEntitiesToModelsMappingProfile>());
            var mapper        = configuration.CreateMapper();
        }
コード例 #3
0
        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"
                }
            };
        }
コード例 #4
0
 public RealDatabase()
 {
     DatabaseContext = StorageBuilder.GetContext();
     UnitOfWork      = (UnitOfWork)StorageBuilder.GetUnitOfWork(DatabaseContext);
 }
コード例 #5
0
 public TestBase()
 {
     InMemoryDatabaseContext = StorageBuilder.GetInMemContext();
     UnitOfWork = (UnitOfWork)StorageBuilder.GetUnitOfWork(InMemoryDatabaseContext);
 }