public void ChangePassword_Invalid_Old_Password() { //Arrange uut = new ManageProfileHandler(mockContext.Object); Participant participant = new Participant { Email = "*****@*****.**", Age = DateTime.Now.Date, English = true, Gender = true, IdParticipant = 0, Password = "******", }; string oldPassword = "******"; //Act DbStatus status = uut.ChangePasswordParticipantDB(participant, oldPassword); Participant newParticipant = mockContext.Object.Participant.FirstOrDefault(part => part.IdParticipant == participant.IdParticipant); //Assert Assert.That(newParticipant.Password != participant.Password); Assert.That(status.success == false); Assert.That(status.errormessage == "The old password was incorrect. Please try again"); }
public void ChangePassword_Valid_Old_Password() { //Arrange uut = new ManageProfileHandler(mockContext.Object); Participant participant = new Participant { Email = "*****@*****.**", Age = DateTime.Now.Date, English = true, Gender = true, IdParticipant = 0, Password = "******", }; string oldPassword = "******"; //Act uut.ChangePasswordParticipantDB(participant, oldPassword); Participant newParticipant = mockContext.Object.Participant.FirstOrDefault(part => part.IdParticipant == participant.IdParticipant); //Assert Assert.That(newParticipant.Password == participant.Password); }