Ejemplo n.º 1
0
 public static bool ChangeNameScopeIsValid(this StrongPoint strongPoint, string name)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(name, Errors.InvalidStrongPoint),
                AssertionConcern.AssertArgumentLength(name, 2, 50, Errors.InvalidStrongPoint)
                ));
 }
Ejemplo n.º 2
0
        public void Validar()
        {
            AssertionConcern.AssertArgumentLength(this.Nome, 3, 100, "Nome de Usuário Inválido");

            EmailAssertionConcern.AssertIsValid(this.Email);
            PasswordAssertionConcern.AssertIsValid(this.Senha);
        }
Ejemplo n.º 3
0
 public static bool CreateCoacheeScopeIsValid(this Coachee coachee)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(coachee.Profession, Errors.InvalidProfession),
                AssertionConcern.AssertArgumentLength(coachee.Profession, 2, 25, Errors.InvalidProfession)
                ));
 }
Ejemplo n.º 4
0
 public static bool ChangeAuthorScopeIsValid(this EvaluationTool evaluationTool, string author)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(author, Errors.AuthorInvalid),
                AssertionConcern.AssertArgumentLength(author, 2, 60, Errors.AuthorInvalid)
                ));
 }
 public static bool ValidCompanyName(this Customer customer)
 {
     return(AssertionConcern.IsValid(
                AssertionConcern.AssertArgumentLength(customer.CompanyName, 3, 80, "Nome da empresa deve possuir mais que 2 até 80 caracteres."),
                AssertionConcern.AssertArgumentNotEmpty(customer.CompanyName, "Informe o nome da empresa.")
                ));
 }
Ejemplo n.º 6
0
        public void Validate(int Attendance, int QualityFood, int Delivery, string Commentary, int idRating)
        {
            if (idRating > 0)
            {
                this.IdRating = idRating;
            }

            if (AssertionConcern.AssertArgumentRangeNumeric(Attendance, 0, 5, Errors.RangeNumeric))
            {
                this.Attendance = Attendance;
            }

            if (AssertionConcern.AssertArgumentRangeNumeric(QualityFood, 0, 5, Errors.RangeNumeric))
            {
                this.QualityFood = QualityFood;
            }

            if (AssertionConcern.AssertArgumentRangeNumeric(Delivery, 0, 5, Errors.RangeNumeric))
            {
                this.Delivery = Delivery;
            }

            if (AssertionConcern.AssertArgumentLength(Commentary, 0, 500, Errors.CommentaryInvalid))
            {
                this.Commentary = Commentary;
            }
        }
Ejemplo n.º 7
0
 public static bool ChangeNameScopeIsValid(this Speciality speciality, string name)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(name, Errors.InvalidSpecialty),
                AssertionConcern.AssertArgumentLength(name, 2, 50, Errors.InvalidSpecialty)
                ));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Validate Entity Data
 /// </summary>
 public override void Validate()
 {
     AssertionConcern.AssertArgumentLength(this.Name, 3, 64, string.Format(ValidationMessages.MinMaxLength, "name", 3, 64));
     AssertionConcern.AssertArgumentLength(this.Unit, 3, 16, string.Format(ValidationMessages.MinMaxLength, "unit", 3, 16));
     AssertionConcern.AssertArgumentNotEquals(this.Price, 0, string.Format(ValidationMessages.InvalidPrice, "0"));
     AssertionConcern.AssertArgumentNotNull(this.Category, string.Format(ValidationMessages.RequiredField, "category"));
 }
Ejemplo n.º 9
0
 public static bool ChangeReplyScopeIsValid(this Reply reply, string bodyReply)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(bodyReply, Errors.ReplyIsRequired),
                AssertionConcern.AssertArgumentLength(bodyReply, 1, 256, Errors.InvalidReply)
                ));
 }
Ejemplo n.º 10
0
 public static bool ChangeNameScopeIsValid(this Weakness weakness, string name)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(weakness.Name, Errors.InvalidWeakness),
                AssertionConcern.AssertArgumentLength(weakness.Name, 2, 50, Errors.InvalidWeakness)
                ));
 }
Ejemplo n.º 11
0
        public void SetName(string name)
        {
            AssertionConcern.AssertArgumentNotEmpty(name, "Name is required");
            AssertionConcern.AssertArgumentLength(name, MinLength, MaxLength, string.Format("Name needs to be between {0} and {1} characters", MinLength, MaxLength));

            Name = name;
        }
Ejemplo n.º 12
0
 public static bool ChangeEducationScopeIsValid(this Question question, string enunciation)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(question.Enunciation, Errors.EnuciationIsRequired),
                AssertionConcern.AssertArgumentLength(question.Enunciation, 2, 256, Errors.InvalidEnunciation)
                ));
 }
Ejemplo n.º 13
0
 public static bool ChangeNumberScopeIsValid(this Phone phone, string number)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(phone.Number, Errors.InvalidPhone),
                AssertionConcern.AssertArgumentLength(phone.Number, 8, 8, Errors.InvalidPhone)
                ));
 }
Ejemplo n.º 14
0
 public static bool ChangeDDDScopeIsValid(this Phone phone, string ddd)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(ddd, Errors.InvalidDDD),
                AssertionConcern.AssertArgumentLength(ddd, 2, 2, Errors.InvalidDDD)
                ));
 }
Ejemplo n.º 15
0
 public static bool ValidName(this Category category)
 {
     return(AssertionConcern.IsValid(
                AssertionConcern.AssertArgumentLength(category.Name, 3, 30, "Nome da categoria deve possuir mais que 3 até 30 caracteres."),
                AssertionConcern.AssertArgumentNotNull(category.Name, "Informe o nome da categoria.")
                ));
 }
Ejemplo n.º 16
0
 public static bool ChangeGroupScopeIsValid(this Reply reply, string group)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(group, Errors.GroupIsRequired),
                AssertionConcern.AssertArgumentLength(group, 1, 60, Errors.InvalidGroup)
                ));
 }
 public static bool ChangeIndicatorScopeIsValid(this PerformanceIndicator performanceIndicator, string indicator)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(indicator, Errors.IndicatorIsRequired),
                AssertionConcern.AssertArgumentLength(indicator, 2, 50, Errors.InvalidIndicator)
                ));
 }
Ejemplo n.º 18
0
 public static bool ValidDescription(this Product product)
 {
     return(AssertionConcern.IsValid(
                AssertionConcern.AssertArgumentLength(product.Description, 3, 120, "Descrição do produto deve possuir mais que 3 até 120 caracteres."),
                AssertionConcern.AssertArgumentNotEmpty(product.Description, "Informe a descrição do produto.")
                ));
 }
Ejemplo n.º 19
0
 public static bool CreateSpecialityScopeIsValid(this Speciality speciality)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(speciality.Name, Errors.InvalidSpecialty),
                AssertionConcern.AssertArgumentLength(speciality.Name, 2, 50, Errors.InvalidSpecialty)
                ));
 }
Ejemplo n.º 20
0
 public static bool ValidName(this Product product)
 {
     return(AssertionConcern.IsValid(
                AssertionConcern.AssertArgumentLength(product.Name, 3, 20, "Produto deve possuir mais que 3 até 20 caracteres."),
                AssertionConcern.AssertArgumentNotEmpty(product.Name, "Informe o produto.")
                ));
 }
Ejemplo n.º 21
0
 public static bool ChangeNameScopeIsValid(this EvaluationTool evaluationTool, string name)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(name, Errors.NameIsRequired),
                AssertionConcern.AssertArgumentLength(name, 2, 60, Errors.InvalidName)
                ));
 }
Ejemplo n.º 22
0
 public static bool ValidName(this Model model)
 {
     return(AssertionConcern.IsValid(
                AssertionConcern.AssertArgumentLength(model.Nome, 3, 50, "Modelo deve possuir mais que 3 até 50 caracteres."),
                AssertionConcern.AssertArgumentNotEmpty(model.Nome, "Informe o modelo.")
                ));
 }
 public static bool ValidPassword(this Customer customer)
 {
     return(AssertionConcern.IsValid(
                AssertionConcern.AssertArgumentLength(customer.Password, 8, 16, "Senha deve possuir mais que 7 até 16 caracteres."),
                AssertionConcern.AssertArgumentNotEmpty(customer.Password, "Informe a senha.")
                ));
 }
Ejemplo n.º 24
0
 public static bool ChangeThemeScopeIsValid(this Session session, string theme)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(theme, Errors.InvalidTheme),
                AssertionConcern.AssertArgumentLength(theme, 4, 45, Errors.InvalidTheme)
                ));
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="User"/> class
        /// and publishes a <see cref="UserRegistered"/> event.
        /// </summary>
        /// <param name="tenantId">
        /// Initial value of the <see cref="TenantId"/> property.
        /// </param>
        /// <param name="username">
        /// Initial value of the <see cref="Username"/> property.
        /// </param>
        /// <param name="password">
        /// Initial value of the <see cref="Password"/> property.
        /// </param>
        /// <param name="enablement">
        /// Initial value of the <see cref="Enablement"/> property.
        /// </param>
        /// <param name="person">
        /// Initial value of the <see cref="Person"/> property.
        /// </param>
        public User(
            TenantId tenantId,
            string username,
            string password,
            Enablement enablement,
            Person person)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "The tenantId is required.");
            AssertionConcern.AssertArgumentNotNull(person, "The person is required.");
            AssertionConcern.AssertArgumentNotEmpty(username, "The username is required.");
            AssertionConcern.AssertArgumentLength(username, 3, 250, "The username must be 3 to 250 characters.");

            // Defer validation to the property setters.
            this.Enablement = enablement;
            this.Person     = person;
            this.TenantId   = tenantId;
            this.Username   = username;

            this.ProtectPassword(string.Empty, password);

            person.User = this;

            DomainEventPublisher
            .Instance
            .Publish(new UserRegistered(
                         tenantId,
                         username,
                         person.Name,
                         person.ContactInformation.EmailAddress));
        }
Ejemplo n.º 26
0
        public void SetNumber(string number)
        {
            AssertionConcern.AssertArgumentNotEmpty(number, Errors.PhoneNumberRequired);
            AssertionConcern.AssertArgumentLength(number, NumberMaxLength, string.Format(Errors.NumberMaxLength, NumberMaxLength));

            Number = number;
        }
Ejemplo n.º 27
0
 public static bool ChangeProfessionScopeIsValid(this Coachee coachee, string profession)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(profession, Errors.InvalidProfession),
                AssertionConcern.AssertArgumentLength(profession, 2, 25, Errors.InvalidProfession)
                ));
 }
Ejemplo n.º 28
0
        public void SetDdd(string ddd)
        {
            AssertionConcern.AssertArgumentNotEmpty(ddd, Errors.DddNumberRequired);
            AssertionConcern.AssertArgumentLength(ddd, DddMaxLength, string.Format(Errors.DddMaxLength, DddMaxLength));

            Ddd = ddd;
        }
Ejemplo n.º 29
0
 public void Validar()
 {
     AssertionConcern.AssertArgumentNotNull(this.Nome, Errors.nomeUsuarioInvalido);
     AssertionConcern.AssertArgumentLength(this.Nome, 3, 50, Errors.nomeUsuarioInvalido);
     EmailAssertionConcern.AssertIsValid(this.Email);
     SenhaAssertionConcern.AssertIsValid(this.Senha);
 }
Ejemplo n.º 30
0
        public void ChangeName(string name)
        {
            AssertionConcern.AssertArgumentNotNull(name, Errors.InvalidUserName);
            AssertionConcern.AssertArgumentLength(Name, 3, 60, Errors.InvalidUserName);

            Name = name;
        }