public void TestMethod4_AddUser() { UserModel usr = new UserModel() { EmployeeId = 100, FirstName = "Animesh", LastName = "Singh", UserId = 100 }; Mock <IProjectDbService> mock = new Mock <IProjectDbService>(); ProjectManagerBL projBL = new ProjectManagerBL(mock.Object); projBL.AddUser(usr); mock.Verify(c => c.AddUser(It.IsAny <Usr>()), Times.Once); }
// POST: api/TaskManager public void AddUser([FromBody] User user) { ProjectManagerBL taskManagerBL = new ProjectManagerBL(); taskManagerBL.AddUser(new DA.User() { Task_ID = user.TaskId, Project_ID = user.ProjectId, LastName = user.LastName, FirstName = user.FirstName, Employee_ID = user.EmployeeId }); }
public void DeleteUserSuccessTest() { Users newUser = new Users() { UserId = 4, EmployeeId = "IT004", FirstName = "Robert", LastName = "Jose" }; ProjectManagerBL tb = new ProjectManagerBL(dbContext.Object); tb.AddUser(newUser); string result = tb.DeleteUser(10); Assert.AreEqual(result, "Users Deleted Successfully"); }
public void AddUserTest() { Users newUser = new Users() { UserId = 4, EmployeeId = "IT004", FirstName = "Robert", LastName = "Jose" }; ProjectManagerBL tb = new ProjectManagerBL(dbContext.Object); string result = tb.AddUser(newUser); Assert.AreEqual(result, "User Added Successfully"); Users confirmResult = tb.GetUserById(4); Assert.AreEqual(confirmResult, newUser); }
public IHttpActionResult AddUser(Users user) { ProjectManagerBL obj = new ProjectManagerBL(_db); return(Ok(obj.AddUser(user))); }