コード例 #1
0
 public UserControllerTest()
 {
     _dbContext  = new Mock <DatabaseContext>();
     _controller = new TestUserController();
     _dbContext.Setup(i => i.GetUserResponse(It.IsAny <int>())).Returns(GetValidUserResponse());
     _controller.DBContext = _dbContext.Object;
 }
コード例 #2
0
        public bool DeleteUser(User userToDelete)
        {
            bool status = false;
            TestUserController controller = new TestUserController();

            _db.Remove(userToDelete);
            if (SaveChanges())
            {
                status = true;
            }

            return(status);
        }