예제 #1
0
        public void TestUserLockAndUnlock()
        {
            var userID = new Random().Next(1, 10);
            var email = "email" + userID + "@11.com";

            var lockCmd = new LockUser(userID, "test reason", 1);
            var unlockCmd = new UnlockUser(userID, "test reason", 1);

            Assert.DoesNotThrow(delegate
            {
                this.commandBus.Send(lockCmd);
            });
            var user = IoC.Resolve<IUserRepository>().FindById<User>(userID);

            Assert.True(user.Membership.IsLocked);

            Assert.DoesNotThrow(delegate
            {
                this.commandBus.Send(unlockCmd);
            });

            user = IoC.Resolve<IUserRepository>().FindById<User>(userID);
            Assert.False(user.Membership.IsLocked);
        }
예제 #2
0
        public ActionResult Unlock(int userID, string reason)
        {
            var cmd = new UnlockUser(userID, reason, this.CurrentUser.UserID);
            this.CommandBus.Send(cmd);

            return Json(JsonResult.Success);
        }