public void TestChangePassword() { // var dataPersistence = ApplicationServiceContext.Current.GetService<IDataPersistenceService<SecurityUser>>(); IIdentityProviderService identityProvider = ApplicationServiceContext.Current.GetService <IIdentityProviderService>(); //var user = dataPersistence.Query(u => u.UserName == "*****@*****.**", null).First(); // var existingPassword = user.PasswordHash; // Now change the password var principal = identityProvider.Authenticate("*****@*****.**", "password"); identityProvider.ChangePassword("*****@*****.**", "newpassword", principal); principal = identityProvider.Authenticate("*****@*****.**", "newpassword"); identityProvider.ChangePassword("*****@*****.**", "password", principal); //user = dataPersistence.Get(user.Id(), principal, false); //Assert.AreNotEqual(existingPassword, user.PasswordHash); // Change the password back //user.PasswordHash = existingPassword; //dataPersistence.Update(user, principal, TransactionMode.Commit); }