public void ExistsByIdTestIsTrue()
        {
            // Arrange
            delegationRepository.Save(new Delegation()
            {
                DelegationId    = 999999,
                CreatedDateTime = DateTime.Now,
                StartDate       = DateTime.Now,
                EndDate         = DateTime.Now,
            });

            // Act
            var result = delegationRepository.ExistsById(999999);

            // Assert
            Assert.IsTrue(result);
        }
        public void CancelDelegation(int delegationId, string headEmail)
        {
            if (headEmail != userService.FindUserByEmail(headEmail).Department.Head.Email)
            {
                throw new ArgumentException("Only Department Heads can cancel delegations");
            }

            if (!delegationRepository.ExistsById(delegationId))
            {
                throw new ArgumentException("Delegation does not exist");
            }

            var delegation = FindDelegationByDelegationId(delegationId);

            userService.RemoveDepartmentHeadRole(delegation.Receipient.Email);
            delegation.Status          = new StatusService(context).FindStatusByStatusId(3);
            delegation.UpdatedBy       = userService.FindUserByEmail(headEmail);
            delegation.UpdatedDateTime = DateTime.Now;
            delegationRepository.Save(delegation);
        }