Пример #1
0
        public void GetUserByIdTest()
        {
            ProjectManagerBL tb     = new ProjectManagerBL(dbContext.Object);
            Users            result = tb.GetUserById(1);

            Assert.AreEqual(result.UserId, 1);
        }
Пример #2
0
        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);
        }
Пример #3
0
        public void UpdateUserTest()
        {
            Users newUser = new Users()
            {
                UserId = 3, EmployeeId = "IT006", FirstName = "David", LastName = "Han"
            };
            ProjectManagerBL tb     = new ProjectManagerBL(dbContext.Object);
            string           result = tb.UpdateUser(newUser);

            dbContext.Verify(x => x.SaveChanges());
            Assert.AreEqual(result, "User Updated Successfully");

            Users confirmResult = tb.GetUserById(3);

            Assert.AreEqual(confirmResult.EmployeeId, newUser.EmployeeId);
        }
Пример #4
0
        public IHttpActionResult GetUser(int id)
        {
            ProjectManagerBL obj = new ProjectManagerBL(_db);

            return(Ok(obj.GetUserById(id)));
        }
Пример #5
0
 public UserSet GetUserById(int id)
 {
     return(pbl.GetUserById(id));;
 }