Пример #1
0
        public void Approve_LogAlreadyProcessed()
        {
            var log = new KudosLog
            {
                Status = KudosStatus.Rejected
            };

            Assert.Throws <ValidationException>(() => log.Approve(_userId));
        }
Пример #2
0
        public void Approve_SenderCannotApproveKudos()
        {
            var log = new KudosLog
            {
                CreatedBy = Guid.NewGuid().ToString()
            };

            Assert.Throws <ValidationException>(() => log.Approve(_userId));
        }
Пример #3
0
        public void Approve_SenderCannotSendKudosToSelf()
        {
            var log = new KudosLog
            {
                EmployeeId = _userId
            };

            Assert.Throws <ValidationException>(() => log.Approve(_userId));
        }
Пример #4
0
        public void Approve_ApprovesAndSetsModifiedAttributes()
        {
            var log = new KudosLog
            {
                Status     = KudosStatus.Pending,
                EmployeeId = Guid.NewGuid().ToString(),
                CreatedBy  = Guid.NewGuid().ToString()
            };

            log.Approve(_userId);

            Assert.That(log.Status, Is.EqualTo(KudosStatus.Approved));
            Assert.That(log.ModifiedBy, Is.EqualTo(_userId));
            Assert.That(log.Modified, Is.InRange(DateTime.UtcNow.AddSeconds(-10), DateTime.UtcNow.AddSeconds(10)));
        }
Пример #5
0
        public void Approve_UserIsEmpty()
        {
            var log = new KudosLog();

            Assert.Throws <ValidationException>(() => log.Approve(string.Empty));
        }