Exemple #1
0
        public async void ProjectId_Update_length()
        {
            Mock <IReleaseRepository> releaseRepository = new Mock <IReleaseRepository>();

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

            var validator = new ApiReleaseRequestModelValidator(releaseRepository.Object);
            await validator.ValidateUpdateAsync(default(string), new ApiReleaseRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.ProjectId, new string('A', 151));
        }
Exemple #2
0
        private async void BeUniqueByVersionProjectId_Update_Exists()
        {
            Mock <IReleaseRepository> releaseRepository = new Mock <IReleaseRepository>();

            releaseRepository.Setup(x => x.ByVersionProjectId(It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult <Release>(new Release()));
            var validator = new ApiReleaseRequestModelValidator(releaseRepository.Object);

            await validator.ValidateUpdateAsync(default(string), new ApiReleaseRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.ProjectId, "A");
        }