Example #1
0
        public async void PipelineStepId_Create_Valid_Reference()
        {
            Mock <IOtherTransportRepository> otherTransportRepository = new Mock <IOtherTransportRepository>();

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

            var validator = new ApiOtherTransportRequestModelValidator(otherTransportRepository.Object);
            await validator.ValidateCreateAsync(new ApiOtherTransportRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.PipelineStepId, 1);
        }
Example #2
0
        public async void HandlerId_Update_Valid_Reference()
        {
            Mock <IOtherTransportRepository> otherTransportRepository = new Mock <IOtherTransportRepository>();

            otherTransportRepository.Setup(x => x.GetHandler(It.IsAny <int>())).Returns(Task.FromResult <Handler>(new Handler()));

            var validator = new ApiOtherTransportRequestModelValidator(otherTransportRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiOtherTransportRequestModel());

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