Ejemplo n.º 1
0
        public async void ProjectId_Update_length()
        {
            Mock <IArtifactRepository> artifactRepository = new Mock <IArtifactRepository>();

            artifactRepository.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(new Artifact()));

            var validator = new ApiArtifactRequestModelValidator(artifactRepository.Object);
            await validator.ValidateUpdateAsync(default(string), new ApiArtifactRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.ProjectId, new string('A', 51));
        }
Ejemplo n.º 2
0
        public async void Filename_Create_length()
        {
            Mock <IArtifactRepository> artifactRepository = new Mock <IArtifactRepository>();

            artifactRepository.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(new Artifact()));

            var validator = new ApiArtifactRequestModelValidator(artifactRepository.Object);
            await validator.ValidateCreateAsync(new ApiArtifactRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Filename, new string('A', 201));
        }