Exemplo n.º 1
0
        public void CommitmentIdShouldBeValid()
        {
            _validCommand.CommitmentId = 0;

            Func <Task> act = async() => await _handler.Handle(_validCommand);

            act.ShouldThrow <ValidationException>().And.Message.Should().Contain("Commitment Id");
        }
Exemplo n.º 2
0
        public void ShouldNotAllowDeleteIfApprenticesAreNotPreApprovedState()
        {
            var testCommitment = new Commitment
            {
                ProviderId      = 123,
                Apprenticeships = new List <Apprenticeship>
                {
                    new Apprenticeship {
                        PaymentStatus = PaymentStatus.Active
                    },
                    new Apprenticeship {
                        PaymentStatus = PaymentStatus.PendingApproval
                    },
                    new Apprenticeship {
                        PaymentStatus = PaymentStatus.PendingApproval
                    }
                }
            };

            _mockCommitmentRepository.Setup(x => x.GetCommitmentById(It.IsAny <long>())).ReturnsAsync(testCommitment);

            Func <Task> act = async() => await _handler.Handle(_validCommand);

            act.ShouldThrow <UnauthorizedException>().And.Message.Should().Contain("Commitment cannot be deleted");
        }