public void AddMentee() { //Arrange var mockRepo = new MockMenteeRepository(); var manager = new MenteeManager(mockRepo); //Test Data var mentee = new MenteeModel { Bio = "My test bio", Address = "Lagos", Gender = "Lagos", }; //Act manager.AddMentee(mentee, 1); //Assert Assert.IsTrue(manager.GetMentee(mentee.UserId) != null, "Mentee was not created"); }
public void AssignMentor() { //Arrange var mockRepo = new MockMenteeRepository(); var manager = new MenteeManager(mockRepo); //Test Data var mentee = new MenteeModel { Category = "Art" }; //Act manager.AddMentee(mentee, 1); manager.AssignMentor(mentee, 11); //Assert Assert.IsTrue(mockRepo.Mentored(mentee.UserId), "Mentor was not assigned"); }
public ActionResult AddBio(MenteeBioModel model, int userId) { //Get user by id var user = _user.GetUserById(userId); //Populate Category Dropdown List var categories = _user.GetCategories(); model.Categories = GetSelectListItems(categories); if (ModelState.IsValid) { try { //Map MenteeBio info to mentee table var mentee = new MenteeModel { UserId = user.UserId, Address = model.Address, Birthday = model.Birthday, Gender = model.Gender, MobileNo = model.MobileNo, Bio = model.Bio, Category = model.Category }; _mentee.AddMentee(mentee, user.UserId); //Trying to log user in immediately after adding profile var identity = user.GetUserIdentity(); AuthenticationManager.SignIn(identity); return(RedirectToAction("index")); } catch (Exception ex) { ModelState.AddModelError("Invalid Reg", ex.Message); } } return(View(model)); }