Beispiel #1
0
        public async void Name_Update_length()
        {
            Mock <IPipelineStatusRepository> pipelineStatusRepository = new Mock <IPipelineStatusRepository>();

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

            var validator = new ApiPipelineStatusServerRequestModelValidator(pipelineStatusRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiPipelineStatusServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129));
        }
Beispiel #2
0
        public async void Name_Create_null()
        {
            Mock <IPipelineStatusRepository> pipelineStatusRepository = new Mock <IPipelineStatusRepository>();

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

            var validator = new ApiPipelineStatusServerRequestModelValidator(pipelineStatusRepository.Object);
            await validator.ValidateCreateAsync(new ApiPipelineStatusServerRequestModel());

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