Example #1
0
        public void ThenUserIdMandatory()
        {
            //Arrange
            var command = new TriageApprenticeshipDataLocksCommand();

            //Act
            var result = _validator.Validate(command);

            //Assert
            Assert.IsFalse(result.IsValid);
            Assert.IsTrue(
                result.Errors.Any(
                    x => x.PropertyName.Contains(nameof(TriageApprenticeshipDataLocksCommand.UserId))));
        }
Example #2
0
        public async Task ThenTheCommandIsValidated()
        {
            //Arrange
            var command = new TriageApprenticeshipDataLocksCommand
            {
                ApprenticeshipId = 1,
                TriageStatus     = TriageStatus.Change,
                UserId           = "USER"
            };

            //Act
            await _handler.Handle(command, new CancellationToken());

            //Assert
            _validator.Verify(x => x.Validate(It.IsAny <TriageApprenticeshipDataLocksCommand>()), Times.Once);
        }
Example #3
0
        public async Task ThenTheApiIsCalledToTriageDataLocks()
        {
            //Arrange
            var command = new TriageApprenticeshipDataLocksCommand
            {
                ApprenticeshipId = 1,
                TriageStatus     = TriageStatus.Change,
                UserId           = "USER"
            };

            //Act
            await _handler.Handle(command, new CancellationToken());

            //Assert
            _commitmentsApi.Verify(x => x.PatchDataLocks(It.IsAny <long>(), It.IsAny <long>(),
                                                         It.IsAny <DataLockTriageSubmission>()), Times.Once());
        }
Example #4
0
        public void ThenCommandIsValidWhenAllPropertiesAreProvided()
        {
            //Arrange
            var command = new TriageApprenticeshipDataLocksCommand
            {
                ApprenticeshipId = 1,
                ProviderId       = 666,
                TriageStatus     = TriageStatus.Change,
                UserId           = "TEST"
            };

            //Act
            var result = _validator.Validate(command);

            //Assert
            Assert.IsTrue(result.IsValid);
        }
Example #5
0
        public void ThenTriageStatusIsMandatory()
        {
            //Arrange
            var command = new TriageApprenticeshipDataLocksCommand
            {
                TriageStatus = TriageStatus.Unknown - 1
            };

            //Act
            var result = _validator.Validate(command);

            //Assert
            Assert.IsFalse(result.IsValid);
            Assert.IsTrue(
                result.Errors.Any(
                    x => x.PropertyName.Contains(nameof(TriageApprenticeshipDataLocksCommand.TriageStatus))));
        }