示例#1
0
        public async void PipelineStepId_Create_Valid_Reference()
        {
            Mock <IPipelineStepStepRequirementRepository> pipelineStepStepRequirementRepository = new Mock <IPipelineStepStepRequirementRepository>();

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

            var validator = new ApiPipelineStepStepRequirementRequestModelValidator(pipelineStepStepRequirementRepository.Object);
            await validator.ValidateCreateAsync(new ApiPipelineStepStepRequirementRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.PipelineStepId, 1);
        }
示例#2
0
        public async void Detail_Create_null()
        {
            Mock <IPipelineStepStepRequirementRepository> pipelineStepStepRequirementRepository = new Mock <IPipelineStepStepRequirementRepository>();

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

            var validator = new ApiPipelineStepStepRequirementRequestModelValidator(pipelineStepStepRequirementRepository.Object);
            await validator.ValidateCreateAsync(new ApiPipelineStepStepRequirementRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Detail, null as string);
        }