public static open_ssnContext GetInMemContextWithRoleData()
        {
            open_ssnContext context = GetInMemContext();

            AddRoleData(context);
            return(context);
        }
 public ExternalAuthController(UserManager <ApplicationUser> userManager, open_ssnContext appDbContext, IJwtFactory jwtFactory, IOptions <JwtIssuerOptions> jwtOptions)
 {
     _userManager  = userManager;
     _appDbContext = appDbContext;
     _jwtFactory   = jwtFactory;
     _jwtOptions   = jwtOptions.Value;
 }
        public static open_ssnContext GetInMemContextUserAndRoleData()
        {
            open_ssnContext context = GetInMemContext();

            AddUnconnectedUsers(context);
            AddRoleData(context);
            return(context);
        }
        public static open_ssnContext GetInMemContext()
        {
            var options = new DbContextOptionsBuilder <open_ssnContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;
            var context = new open_ssnContext(options);

            //optionally fill database with data

            return(context);
        }
 public TestController(
     open_ssnContext context,
     UserManager <ApplicationUser> userManager,
     IHttpContextAccessor httpContextAccessor,
     IHostingEnvironment env)
 {
     _context             = context;
     _userManager         = userManager;
     _httpContextAccessor = httpContextAccessor;
     _env = env;
 }
        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);
        }
        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();
        }
        public static void AddUnconnectedUsers(open_ssnContext context)
        {
            Password pw = new Password
            {
                Hash = "XXXXXXXX"
            };
            User usr = new User
            {
                Email           = "*****@*****.**",
                EmailConfirmed  = true,
                NormalizedEmail = "*****@*****.**",
                Password        = pw
            };

            context.Set <User>().Add(usr);
            context.SaveChanges();
        }
        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"
                }
            };
        }
Пример #10
0
 public FileController(open_ssnContext context, IHostingEnvironment hostingEnvironment)
 {
     _context            = context;
     _hostingEnvironment = hostingEnvironment;
 }
Пример #11
0
 public CustomsCargoController(open_ssnContext context)
 {
     _context = context;
 }
 public PortCallDetailsController(open_ssnContext context)
 {
     _context = context;
 }
 public ShipHullTypeController(open_ssnContext context)
 {
     _context = context;
 }
 public IdentityDocumentTypeController(open_ssnContext context)
 {
     _context = context;
 }
 public LocationTypeController(open_ssnContext context)
 {
     this._context = context;
 }
 public CertificateOfRegistryController(open_ssnContext context)
 {
     _context = context;
 }
Пример #17
0
 public CompanySecurityOfficerController(open_ssnContext context)
 {
     _context = context;
 }
 public ShipStatusController(open_ssnContext context)
 {
     _context = context;
 }
 public ShipLengthTypeController(open_ssnContext context)
 {
     _context = context;
 }
 public ConsignmentController(open_ssnContext context)
 {
     _context = context;
 }
 public RealDatabase()
 {
     DatabaseContext = StorageBuilder.GetContext();
     UnitOfWork      = (UnitOfWork)StorageBuilder.GetUnitOfWork(DatabaseContext);
 }
Пример #22
0
 public ShipBreadthTypeController(open_ssnContext context)
 {
     _context = context;
 }
Пример #23
0
 public ShipSourceController(open_ssnContext context)
 {
     _context = context;
 }
Пример #24
0
 public ShipFlagCodeController(open_ssnContext context)
 {
     _context = context;
 }
Пример #25
0
 public GenderController(open_ssnContext context)
 {
     _context = context;
 }
Пример #26
0
 public PurposeController(open_ssnContext context)
 {
     _context = context;
 }
Пример #27
0
 public OrganizationTypeController(open_ssnContext context)
 {
     _context = context;
 }
 public ShipPowerTypeController(open_ssnContext context)
 {
     _context = context;
 }
Пример #29
0
 public CountryController(open_ssnContext context)
 {
     _context = context;
 }
Пример #30
0
 public FalShipStoresController(open_ssnContext context)
 {
     _context = context;
 }