public function testResetPasswordEncryptsAndUpdates() { $password = '******'; $salt = 'salt'; $encrypted = 'encrypted'; $userId = 123; $this->page->expects($this->atLeastOnce())->method('GetUserId')->will($this->returnValue($userId)); $this->page->expects($this->once())->method('GetPassword')->will($this->returnValue($password)); $this->encryption->expects($this->once())->method('Salt')->will($this->returnValue($salt)); $this->encryption->expects($this->once())->method('Encrypt')->with($this->equalTo($password), $this->equalTo($salt))->will($this->returnValue($encrypted)); $user = new User(); $this->userRepo->expects($this->once())->method('LoadById')->with($this->equalTo($userId))->will($this->returnValue($user)); $this->userRepo->expects($this->once())->method('Update')->with($this->equalTo($user)); $this->presenter->ResetPassword(); $this->assertEquals($encrypted, $user->encryptedPassword); $this->assertEquals($salt, $user->passwordSalt); }