public async Task ForgetPassword_ShouldReturnSuccess_WhenPasswordValidforusername() { //Arrange forgetPassword ObjforgetPassword = new forgetPassword(); ObjforgetPassword.LogID = "monica"; ObjforgetPassword.LogInDetail = "Username"; ObjforgetPassword.Password = "******"; ForgetPasswordResponse objRes = new ForgetPasswordResponse(); objRes.LogID = "monica"; objRes.ResponseMessage = "Password Changed Successfully"; string queryString = ""; queryString = "sp_LoginUpdate @LoginId,@LoginDetail,@Password,@MessageStatus Out"; _eventDBMock.Setup(x => x.ExecuteAsyncSql(It.IsAny <SqlParameter[]>(), queryString, 3)).ReturnsAsync("Password Changed Successfully"); //Act var customer = await _eventBookingRepository.ForgetPasswordDB(ObjforgetPassword); //Assert Assert.Equal(objRes.ResponseMessage, customer); }
public async Task ForgetPassword_ShouldReturnSuccess_WhenPasswordValidforusername() { //Arrange forgetPassword ObjforgetPassword = new forgetPassword(); ObjforgetPassword.LogID = "monica"; ObjforgetPassword.LogInDetail = "Username"; ObjforgetPassword.Password = "******"; ForgetPasswordResponse objRes = new ForgetPasswordResponse(); objRes.LogID = "monica"; objRes.ResponseMessage = "Password Changed Successfully"; _eventBookingService.Setup(x => x.ForgetPassword(ObjforgetPassword)).ReturnsAsync(objRes); //Act var customer = await _EventBookingController.ForgetPassword(ObjforgetPassword); //Assert Assert.NotNull(customer); }
public async Task <ForgetPasswordResponse> ForgetPassword(forgetPassword ObjforgetPassword) { ForgetPasswordResponse objForgetPasswordResponse = new ForgetPasswordResponse(); if (string.IsNullOrEmpty(ObjforgetPassword.LogInDetail)) { objForgetPasswordResponse.ResponseMessage = "Please Select whether the Login ID is UserName/Email ID/ Phone Num"; objForgetPasswordResponse.LogID = ObjforgetPassword.LogID; return(objForgetPasswordResponse); } if (string.IsNullOrEmpty(ObjforgetPassword.LogID)) { objForgetPasswordResponse.ResponseMessage = "Please enter UserName/Email ID/ Phone Num"; objForgetPasswordResponse.LogID = ObjforgetPassword.LogID; return(objForgetPasswordResponse); } if (string.IsNullOrEmpty(ObjforgetPassword.Password)) { objForgetPasswordResponse.ResponseMessage = "Please enter Password"; objForgetPasswordResponse.LogID = ObjforgetPassword.LogID; return(objForgetPasswordResponse); } if (ObjforgetPassword.LogInDetail.ToUpper() != "EMAIL" && ObjforgetPassword.LogInDetail.ToUpper() != "USERNAME" && ObjforgetPassword.LogInDetail.ToUpper() != "PHONENUM") { objForgetPasswordResponse.ResponseMessage = "Login Method is invalid, Please Try again!!!"; objForgetPasswordResponse.LogID = ObjforgetPassword.LogID; return(objForgetPasswordResponse); } string ResponseMessage = await _eventBookingRepository.ForgetPasswordDB(ObjforgetPassword); objForgetPasswordResponse.ResponseMessage = ResponseMessage; objForgetPasswordResponse.LogID = ObjforgetPassword.LogID; return(objForgetPasswordResponse); }
public async Task ForgetPassword_ShouldReturnInvalidMessage_IFPasswordnotentered() { //Arrange forgetPassword Obj = new forgetPassword(); Obj.LogID = "monica"; Obj.LogInDetail = "username"; Obj.Password = ""; ForgetPasswordResponse objRes = new ForgetPasswordResponse(); objRes.LogID = "monica"; objRes.ResponseMessage = "Please enter Password"; //_eventRepoMock.Setup(x => x.LogInDB(Obj)).ReturnsAsync("Login Success"); //Act var customer = await _EventBookingService.ForgetPassword(Obj); //Assert Assert.Equal(objRes.LogID, customer.LogID); Assert.Equal(objRes.ResponseMessage, customer.ResponseMessage); }
public async Task ForgetPassword_ShouldReturnInvalidMessage_IFLogINDetailnotvalid() { //Arrange forgetPassword Obj = new forgetPassword(); Obj.LogID = "monica"; Obj.LogInDetail = "dfg"; Obj.Password = "******"; ForgetPasswordResponse objRes = new ForgetPasswordResponse(); objRes.LogID = "monica"; objRes.ResponseMessage = "Login Method is invalid, Please Try again!!!"; //_eventRepoMock.Setup(x => x.LogInDB(Obj)).ReturnsAsync("Login Success"); //Act var customer = await _EventBookingService.ForgetPassword(Obj); //Assert Assert.Equal(objRes.LogID, customer.LogID); Assert.Equal(objRes.ResponseMessage, customer.ResponseMessage); }
public async Task ForgetPassword_ShouldReturnInvalidMessage_IFLogINDetailnotpresent() { //Arrange forgetPassword Obj = new forgetPassword(); Obj.LogID = "monica"; Obj.LogInDetail = ""; Obj.Password = "******"; ForgetPasswordResponse objRes = new ForgetPasswordResponse(); objRes.LogID = "monica"; objRes.ResponseMessage = "Please Select whether the Login ID is UserName/Email ID/ Phone Num"; //_eventRepoMock.Setup(x => x.LogInDB(Obj)).ReturnsAsync("Login Success"); //Act var customer = await _EventBookingService.ForgetPassword(Obj); //Assert Assert.Equal(objRes.LogID, customer.LogID); Assert.Equal(objRes.ResponseMessage, customer.ResponseMessage); }
public async Task ForgetPassword_ShouldReturnSuccess_WhenPasswordInValidforusername() { //Arrange forgetPassword Obj = new forgetPassword(); Obj.LogID = "monic"; Obj.LogInDetail = "Username"; Obj.Password = "******"; ForgetPasswordResponse objRes = new ForgetPasswordResponse(); objRes.LogID = "monic"; objRes.ResponseMessage = "Invalid UserName"; _eventRepoMock.Setup(x => x.ForgetPasswordDB(Obj)).ReturnsAsync("Invalid UserName"); //Act var customer = await _EventBookingService.ForgetPassword(Obj); //Assert Assert.Equal(objRes.LogID, customer.LogID); Assert.Equal(objRes.ResponseMessage, customer.ResponseMessage); }