Esempio n. 1
0
 public void Approve(LeaveItem leave)
 {
     if (_user.IsApprover)
     {
         leave.Status = LeaveItemStatus.Approved;
     }
 }
Esempio n. 2
0
 public void Reject(LeaveItem leave)
 {
     if (_user.IsApprover)
     {
         leave.Status = LeaveItemStatus.Rejected;
     }
 }
Esempio n. 3
0
        public void ANonApproverCannnotRejectLeave()
        {
            var leave = new LeaveItem
            {
                Status = LeaveItemStatus.AwaitingApproval
            };

            var approver = new User
            {
                IsApprover = false
            };

            var sut = CreateSut(approver);

            sut.Reject(leave);

            Assert.AreEqual(LeaveItemStatus.AwaitingApproval, leave.Status);
        }
Esempio n. 4
0
        public void AnApproverCanApproveLeave()
        {
            var leave = new LeaveItem
            {
                Status = LeaveItemStatus.AwaitingApproval
            };
            
            var approver = new User
            {
                IsApprover = true
            };

            var sut = CreateSut(approver);
            
            sut.Approve(leave);

            Assert.AreEqual(LeaveItemStatus.Approved, leave.Status);
        }
Esempio n. 5
0
 public void Add(LeaveItem leaveItem)
 {
     _repository.Insert(leaveItem);
 }