示例#1
0
        public void SetUp()
        {
            _dbConnection = ContextHelper.OpenSqliteInMemoryConnection();
            _dataContext  = ContextHelper.CreateContext(_dbConnection, true);
            _userManager  = ContextHelper.CreateUserManager(_dataContext);
            _roleManager  = ContextHelper.CreateRoleManager(_dataContext);
            _service      = new DefaultDataInitializationService(_userManager, _roleManager);

            _dataContext.Database.EnsureCreated();
        }
示例#2
0
        public void Setup()
        {
            _dbConnection         = ContextHelper.OpenSqliteInMemoryConnection();
            using var dataContext = ContextHelper.CreateContext(_dbConnection, false);
            dataContext.Database.EnsureCreated();

            var configMock = new Mock <IConfiguration>();

            configMock.SetupGet(conf => conf[It.Is <string>(s => s == "Jwt:SigningKey")]).Returns("E7605B2B-0D85-4575-B36C-CF3E6F1BC7D1");
            configMock.SetupGet(conf => conf[It.Is <string>(s => s == "Jwt:Issuer")]).Returns("WorkflowServer");
            configMock.SetupGet(conf => conf[It.Is <string>(s => s == "Jwt:Audience")]).Returns("WorkflowClient");
            configMock.SetupGet(conf => conf[It.Is <string>(s => s == "Jwt:ExpiryInHours")]).Returns("1");

            _dataContext           = ContextHelper.CreateContext(_dbConnection, true);
            _userManager           = ContextHelper.CreateUserManager(_dataContext);
            _authenticationService = new AuthenticationService(_userManager, configMock.Object);

            _vmConverter = new VmUserConverter();
        }