public async Task <bool> Testfor_ValidateUserId() { //Arrange bool res = false; //Act userservice.Setup(repo => repo.Register(_user)).ReturnsAsync(_user); var result = await _userGroceryS.Register(_user); if (result.UserId.Length.ToString() == _user.UserId.Length.ToString()) { res = true; } //Asert //final result displaying in text file await File.AppendAllTextAsync("../../../../output_boundary_revised.txt", "Testfor_ValidateUserId=" + res + "\n"); return(res); }
public async Task <bool> Testfor_Validate_ValidUserRegister() { //Arrange bool res = false; //Act userservice.Setup(repo => repo.Register(_user)).ReturnsAsync(_user); var result = await _userGroceryS.Register(_user); if (result != null) { res = true; } //Asert //final result displaying in text file await File.AppendAllTextAsync("../../../../output_revised.txt", "Testfor_Validate_ValidUserRegister=" + res + "\n"); return(res); }
public async Task <IActionResult> AddNewUser([FromBody] UserViewModel model) { //Do code here ApplicationUser new_user = new ApplicationUser(); new_user.Name = model.Name; new_user.Email = model.Email; new_user.Password = model.Password; new_user.PinCode = model.PinCode; new_user.Road_area = model.Road_area; new_user.State = model.State; new_user.MobileNumber = model.MobileNumber; new_user.HouseNo_Building_Name = model.HouseNo_Building_Name; new_user.State = model.State; Task <ApplicationUser> obj_user = _userGS.Register(new_user); return(Created(HttpContext.Request.Scheme + "://" + HttpContext.Request.Host + HttpContext.Request.Path + "/" + obj_user.Result.UserId, obj_user.Result.Name)); //throw new NotImplementedException(); }
public async Task <IActionResult> AddNewUser([FromBody] UserViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ApplicationUser newuser = new ApplicationUser { Name = model.Name, Email = model.Email, Password = model.Password, MobileNumber = model.MobileNumber, PinCode = model.PinCode, HouseNo_Building_Name = model.HouseNo_Building_Name, Road_area = model.Road_area, City = model.City, State = model.State }; await _userGS.Register(newuser); return(Ok("User Addeed...")); }