Exemplo n.º 1
0
        public async void Thumbprint_Update_length()
        {
            Mock <ICertificateRepository> certificateRepository = new Mock <ICertificateRepository>();

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

            var validator = new ApiCertificateRequestModelValidator(certificateRepository.Object);
            await validator.ValidateUpdateAsync(default(string), new ApiCertificateRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Thumbprint, new string('A', 129));
        }
Exemplo n.º 2
0
        public async void Name_Create_length()
        {
            Mock <ICertificateRepository> certificateRepository = new Mock <ICertificateRepository>();

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

            var validator = new ApiCertificateRequestModelValidator(certificateRepository.Object);
            await validator.ValidateCreateAsync(new ApiCertificateRequestModel());

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