public void ChangePassword(string oldPassword, string newPassword, Action <bool> callback) { var user = Current; if (user == null) { callback(false); } else { var p = PasswordConverter.ConvertBack(newPassword); _usersRunTarget.ChangePassword( user.Name, PasswordConverter.ConvertBack(oldPassword), p, result => { if (result) { _identity = new Identity(user.Id, user.Name, p); } callback(result); }); } }
public void Test() { UsersRunTarget.Verify(t => t.ChangePassword(Name, PasswordConverter.ConvertBack(OldPassword), PasswordConverter.ConvertBack(NewPassword), It.IsAny <Action <bool> >()), Times.Once()); }
protected override void EstablishContext() { base.EstablishContext(); Name = "Name2"; Password = "******"; UserActions = new List <Action <User> >(); UsersRunTarget .Setup(t => t.LogOn(Name, PasswordConverter.ConvertBack(Password), It.IsAny <Action <User> >())) .Callback <string, string, Action <User> >(LogOnCallback); Users.LogOn(Name, Password, Callback); }
protected override void EstablishContext() { base.EstablishContext(); CallbackResult1 = null; OldPassword = "******"; NewPassword = "******"; PswChangeActions = new List <Action <bool> >(); UsersRunTarget .Setup(t => t.ChangePassword(Name, PasswordConverter.ConvertBack(OldPassword), PasswordConverter.ConvertBack(NewPassword), It.IsAny <Action <bool> >())) .Callback <string, string, string, Action <bool> >(ChangePasswordCallback); Users.ChangePassword(OldPassword, NewPassword, Callback1); }
public void LogOn(string name, string password, Action <bool> callback) { var p = PasswordConverter.ConvertBack(password); _usersRunTarget.LogOn(name, p, user => { if (user != null) { Current = user; _identity = new Identity(user.Id, user.Name, p); } callback.Invoke(user != null); }); }
public void SetPassword(long userId, string password, Action <bool> callback) { _usersRunTarget.SetPassword(_identity, userId, PasswordConverter.ConvertBack(password), callback); }
public void Test() { UsersRunTarget.Verify(t => t.LogOn(Name, PasswordConverter.ConvertBack(Password), It.IsAny <Action <User> >()), Times.Once()); }