public void UpdateTestSuccess()
        {
            DeleteDummyAccount();


            try
            {
                var id         = CreateDummyAccount();
                var permission = new Permission(id);
                permission.AddPermission("None");
                var permUpdate = new PermissionUpdateSqlService(_dao, permission);
                var result     = permUpdate.Update();


                Assert.AreEqual(result.IsSuccess, true);
                var permission2 = new Permission(id);
                permission2.RemovePermission("None");
                var permUpdate2 = new PermissionUpdateSqlService(_dao, permission2);
                var result2     = permUpdate2.Update();
                Assert.AreEqual(result2.IsSuccess, true);

                DeleteDummyAccount();
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.ToString());
                Assert.Fail();
            }
        }
コード例 #2
0
 public UserManagementManager(JWTService authService, AuthenticationService authenticationService, SqlCreateAccountService createAccountService, DeleteAccountSQLService deleteAccountService, UpdateAccountSqlService updateAccountService, PermissionUpdateSqlService updatePermissionService)
 {
     //_newAccountDAO = new SqlCreateAccountDAO(Environment.GetEnvironmentVariable("sqlConnectionAccount", EnvironmentVariableTarget.User));
     //_newMappingDAO = new SqlCreateAccountDAO(Environment.GetEnvironmentVariable("sqlConnectionMapping", EnvironmentVariableTarget.User));
     //_newUserDAO = new SqlCreateAccountDAO(Environment.GetEnvironmentVariable("sqlConnectionSystem", EnvironmentVariableTarget.User));
     //_mapperDAO = new SqlMapperDAO(Environment.GetEnvironmentVariable("sqlConnectionMapping", EnvironmentVariableTarget.User));
     //_systemDB = new SqlDAO(Environment.GetEnvironmentVariable("sqlConnectionSystem", EnvironmentVariableTarget.User));
     //_mappingDB = new SqlDAO(Environment.GetEnvironmentVariable("sqlConnectionMapping", EnvironmentVariableTarget.User));
     //_accountDB = new SqlDAO(Environment.GetEnvironmentVariable("sqlConnectionAccount", EnvironmentVariableTarget.User));
     _updatePermissionService = updatePermissionService;
     _updateAccountService    = updateAccountService;
     _createAccountService    = createAccountService;
     _deleteAccountService    = deleteAccountService;
     _authNService            = authenticationService;
     _authService             = authService;
 }
コード例 #3
0
        public UserManagementManager()
        {
            var sqlDao           = new SqlDAO(Environment.GetEnvironmentVariable("sqlConnectionSystem", EnvironmentVariableTarget.User));
            var createAccountDAO = new SqlCreateAccountDAO(Environment.GetEnvironmentVariable("sqlConnectionAccount", EnvironmentVariableTarget.User));
            var newMappingDAO    = new SqlCreateAccountDAO(Environment.GetEnvironmentVariable("sqlConnectionMapping", EnvironmentVariableTarget.User));
            var newUserDAO       = new SqlCreateAccountDAO(Environment.GetEnvironmentVariable("sqlConnectionSystem", EnvironmentVariableTarget.User));
            var mapperDAO        = new SqlMapperDAO(Environment.GetEnvironmentVariable("sqlConnectionMapping", EnvironmentVariableTarget.User));
            var bunchedDaos      = new CreateAccountDAOs(createAccountDAO, newMappingDAO, newUserDAO, mapperDAO);

            _updatePermissionService = new PermissionUpdateSqlService(new SqlDAO(Environment.GetEnvironmentVariable("sqlConnectionSystem", EnvironmentVariableTarget.User)), new SqlMapperDAO(Environment.GetEnvironmentVariable("sqlConnectionMapping", EnvironmentVariableTarget.User)));
            _updateAccountService    = new UpdateAccountSqlService(new SqlDAO(Environment.GetEnvironmentVariable("sqlConnectionSystem", EnvironmentVariableTarget.User)));
            _createAccountService    = new SqlCreateAccountService(bunchedDaos);
            _deleteAccountService    = new DeleteAccountSQLService(new SqlDAO(Environment.GetEnvironmentVariable("sqlConnectionSystem", EnvironmentVariableTarget.User)), new SqlDAO(Environment.GetEnvironmentVariable("sqlConnectionMapping", EnvironmentVariableTarget.User)), new SqlDAO(Environment.GetEnvironmentVariable("sqlConnectionAccount", EnvironmentVariableTarget.User)));
            _authNService            = new AuthenticationService(new GetUserDao(Environment.GetEnvironmentVariable("sqlConnectionSystem", EnvironmentVariableTarget.User)));
            _authService             = new JWTService();
        }
        public void UpdateTestFailure()
        {
            DeleteDummyAccount();
            CreateDummyAccount();

            try
            {
                var permission = new Permission(-1);
                permission.AddPermission("None");
                var permUpdate = new PermissionUpdateSqlService(_dao, permission);
                var result     = permUpdate.Update();



                Assert.Fail();
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.ToString());
                DeleteDummyAccount();
            }
        }