Exemple #1
0
        public async void Name_Create_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.ValidateCreateAsync(new ApiPipelineStepRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129));
        }
Exemple #2
0
        public async void PipelineStepStatusId_Create_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.ValidateCreateAsync(new ApiPipelineStepRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.PipelineStepStatusId, 1);
        }
        public async void ShipperId_Create_Valid_Reference()
        {
            Mock <IPipelineStepRepository> pipelineStepRepository = new Mock <IPipelineStepRepository>();

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

            var validator = new ApiPipelineStepRequestModelValidator(pipelineStepRepository.Object);
            await validator.ValidateCreateAsync(new ApiPipelineStepRequestModel());

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