public ClientIsValidValidation()
        {
            var clientCpf   = new ClientMustHaveValidCpfSpecification();
            var clientEmail = new ClientMustHaveValidEmailSpecification();
            var clientAge   = new ClientMustBeOver18YearSpecification();

            base.Add("clientCpf", new Rule <Client>(clientCpf, "Please provide a valid CPF"));
            base.Add("clientEmail", new Rule <Client>(clientEmail, "Please provide a valid e-mail"));
            base.Add("clientAge", new Rule <Client>(clientAge, "Sorry, you don't have age enough to registry"));
        }
Beispiel #2
0
        public void CpfSpecification_IsSatisfied_False()
        {
            // Arrange
            var client = new Client
            {
                CPF = "12345678901"
            };

            // Act
            var specificationResult = new ClientMustHaveValidCpfSpecification().IsSatisfiedBy(client);

            // Assert
            Assert.IsFalse(specificationResult);
        }
Beispiel #3
0
        public void CpfSpecification_IsSatisfied_True()
        {
            // Arrange
            var client = new Client
            {
                CPF = "93436755427"
            };

            // Act
            var specificationResult = new ClientMustHaveValidCpfSpecification().IsSatisfiedBy(client);

            // Assert
            Assert.IsTrue(specificationResult);
        }