public bool IsUserExist(UserModel userModel) { var userEntity = new Entities.UserDetail { Email = userModel.Email, PhoneNumber = userModel.PhoneNumber }; var user = userRepository.GetById(userEntity); return(user != null); }
public void IsUserExistUserWithUserInfoReturnsExpectedResult() { //Arrange var expected = new Entities.UserDetail { UserId = "12345", FirstName = "Thirumalai", LastName = "Vasan", Password = "******" }; mockRepository.Setup(repo => repo.GetById(It.IsAny <string>())).Returns(expected); //Act var actual = userInfoService.IsUserExist("12345"); //Assert Assert.True(actual); }
public void GetUserWithUserInfoReturnsExpectedResult() { //Arrange var expected = new Entities.UserDetail { UserId = "12345", FirstName = "Thirumalai", LastName = "Vasan", Password = "******" }; mockRepository.Setup(repo => repo.GetUserByUserIdAndPasssword(It.IsAny <string>(), It.IsAny <string>())).Returns(expected); //Act var actual = userInfoService.GetUser("12345", "Test@123"); //Assert Assert.IsAssignableFrom <Models.UserModel>(actual); Assert.Equal(expected.UserId, actual.UserId); }
public int Add(UserModel userModel) { var userEntity = new Entities.UserDetail { FirstName = userModel.FirstName, LastName = userModel.LastName, Password = userModel.Password, ConfirmPassword = userModel.ConfirmPassword, DateOfBirth = userModel.DateOfBirth, Email = userModel.Email, Gender = userModel.Gender, PhoneNumber = userModel.PhoneNumber, RoleId = userModel.PhoneNumber, Status = userModel.Status, Insurance = userModel.Insurance, Description = userModel.Description, License = userModel.License, Permit = userModel.Permit, Registration = userModel.Registration, VehicleNumber = userModel.VehicleNumber, }; return(userRepository.Add(userEntity)); }