コード例 #1
0
        public async void Note_Update_null()
        {
            Mock <IPipelineStepNoteRepository> pipelineStepNoteRepository = new Mock <IPipelineStepNoteRepository>();

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

            var validator = new ApiPipelineStepNoteRequestModelValidator(pipelineStepNoteRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiPipelineStepNoteRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Note, null as string);
        }
コード例 #2
0
        public async void PipelineStepId_Create_Valid_Reference()
        {
            Mock <IPipelineStepNoteRepository> pipelineStepNoteRepository = new Mock <IPipelineStepNoteRepository>();

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

            var validator = new ApiPipelineStepNoteRequestModelValidator(pipelineStepNoteRepository.Object);
            await validator.ValidateCreateAsync(new ApiPipelineStepNoteRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.PipelineStepId, 1);
        }
コード例 #3
0
        public async void EmployeeId_Update_Valid_Reference()
        {
            Mock <IPipelineStepNoteRepository> pipelineStepNoteRepository = new Mock <IPipelineStepNoteRepository>();

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

            var validator = new ApiPipelineStepNoteRequestModelValidator(pipelineStepNoteRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiPipelineStepNoteRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.EmployeeId, 1);
        }
コード例 #4
0
        public async void PipelineStepId_Update_Invalid_Reference()
        {
            Mock <IPipelineStepNoteRepository> pipelineStepNoteRepository = new Mock <IPipelineStepNoteRepository>();

            pipelineStepNoteRepository.Setup(x => x.GetPipelineStep(It.IsAny <int>())).Returns(Task.FromResult <PipelineStep>(null));

            var validator = new ApiPipelineStepNoteRequestModelValidator(pipelineStepNoteRepository.Object);

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

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