Exemple #1
0
        public async void Name_Update_length()
        {
            Mock <IPipelineStepRepository> pipelineStepRepository = new Mock <IPipelineStepRepository>();

            pipelineStepRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new PipelineStep()));

            var validator = new ApiPipelineStepRequestModelValidator(pipelineStepRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiPipelineStepRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129));
        }
Exemple #2
0
        public async void PipelineStepStatusId_Update_Valid_Reference()
        {
            Mock <IPipelineStepRepository> pipelineStepRepository = new Mock <IPipelineStepRepository>();

            pipelineStepRepository.Setup(x => x.GetPipelineStepStatus(It.IsAny <int>())).Returns(Task.FromResult <PipelineStepStatus>(new PipelineStepStatus()));

            var validator = new ApiPipelineStepRequestModelValidator(pipelineStepRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiPipelineStepRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.PipelineStepStatusId, 1);
        }
Exemple #3
0
        public async void ShipperId_Update_Invalid_Reference()
        {
            Mock <IPipelineStepRepository> pipelineStepRepository = new Mock <IPipelineStepRepository>();

            pipelineStepRepository.Setup(x => x.GetEmployee(It.IsAny <int>())).Returns(Task.FromResult <Employee>(null));

            var validator = new ApiPipelineStepRequestModelValidator(pipelineStepRepository.Object);

            await validator.ValidateUpdateAsync(default(int), new ApiPipelineStepRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.ShipperId, 1);
        }