public async void EmployeeId_Create_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.ValidateCreateAsync(new ApiPipelineStepNoteRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.EmployeeId, 1);
        }
        public async void Note_Create_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.ValidateCreateAsync(new ApiPipelineStepNoteRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Note, null as string);
        }
Exemplo n.º 3
0
        public async void PipelineStepId_Create_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.ValidateCreateAsync(new ApiPipelineStepNoteRequestModel());

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