public void UpdateUserTest_Success()
        {
            // Arrange
            ProjectMangerModel.Users model = new ProjectMangerModel.Users
            {
                UserID     = 1,
                FirstName  = "Sathya",
                LastName   = "Natarajan",
                EmployeeID = "433465"
            };

            // Act
            var response = userController.UpdateUser(model);

            // Assert
            Assert.IsTrue(response is OkResult);
        }
        public void AddUserTest_Success()
        {
            // Arrange
            ProjectMangerModel.Users model = new ProjectMangerModel.Users
            {
                UserID     = 4,
                FirstName  = "Meena",
                LastName   = "M",
                EmployeeID = "433466"
            };

            // Act
            var response = userController.AddUser(model);

            // Assert
            Assert.IsTrue(response is OkResult);
        }
Example #3
0
 public IHttpActionResult DeleteUser([FromBody] ProjectMangerModel.Users user)
 {
     try
     {
         CommonEntities.Users usr = new CommonEntities.Users
         {
             UserID     = user.UserID,
             FirstName  = user.FirstName,
             LastName   = user.LastName,
             EmployeeID = user.EmployeeID
         };
         _userBL.DeleteUser(usr);
         return(Ok());
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
 }
        public void AddUserTest_Error()
        {
            // Arrange
            var userController = new UsersController(null);

            ProjectMangerModel.Users model = new ProjectMangerModel.Users
            {
                UserID     = 4,
                FirstName  = "Meena",
                LastName   = "M",
                EmployeeID = "433466"
            };

            // Act
            var response = userController.AddUser(model);

            // Assert
            Assert.IsTrue(response is InternalServerErrorResult);
        }
        public void DeleteUserTest_Error()
        {
            // Arrange
            var userController = new UsersController(null);

            ProjectMangerModel.Users model = new ProjectMangerModel.Users
            {
                UserID     = 1,
                FirstName  = "Sathya",
                LastName   = "Natarajan",
                EmployeeID = "433461"
            };

            // Act
            var response = userController.DeleteUser(model);

            // Assert
            Assert.IsTrue(response is InternalServerErrorResult);
        }