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 ApiPipelineStepNoteServerRequestModelValidator(pipelineStepNoteRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiPipelineStepNoteServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Note, null as string); }
public async void EmployeeId_Update_Invalid_Reference() { Mock <IPipelineStepNoteRepository> pipelineStepNoteRepository = new Mock <IPipelineStepNoteRepository>(); pipelineStepNoteRepository.Setup(x => x.EmployeeByEmployeeId(It.IsAny <int>())).Returns(Task.FromResult <Employee>(null)); var validator = new ApiPipelineStepNoteServerRequestModelValidator(pipelineStepNoteRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiPipelineStepNoteServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.EmployeeId, 1); }
public async void PipelineStepId_Create_Invalid_Reference() { Mock <IPipelineStepNoteRepository> pipelineStepNoteRepository = new Mock <IPipelineStepNoteRepository>(); pipelineStepNoteRepository.Setup(x => x.PipelineStepByPipelineStepId(It.IsAny <int>())).Returns(Task.FromResult <PipelineStep>(null)); var validator = new ApiPipelineStepNoteServerRequestModelValidator(pipelineStepNoteRepository.Object); await validator.ValidateCreateAsync(new ApiPipelineStepNoteServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.PipelineStepId, 1); }