public void Validate_Success() { NullConstraint c = new NullConstraint(); IEnumerable<ParameterValidationResult> result = c.Validate(42, ParameterDataType.Int32, Constants.MemberName); Assert.IsNotNull(result); List<ParameterValidationResult> Temp = new List<ParameterValidationResult>(result); Assert.AreEqual(0, Temp.Count); }
public void Ctor_SerializationInfo_Success() { NullConstraint c = new NullConstraint(); System.IO.MemoryStream Buffer = SerializationHelper.Serialize(c); NullConstraint c2 = SerializationHelper.Deserialize<NullConstraint>(Buffer); Assert.AreEqual(Constraint.NullConstraintName, c2.Name); }
public void Ctor_Void_Success() { NullConstraint c = new NullConstraint(); Assert.AreEqual(Constraint.NullConstraintName, c.Name); }
private Constraint FindConstraint(string name, ParameterDataType type) { Constraint ReturnValue = null; bool IsConstraintNameUnknown = false; switch (name) { case Constraint.AllowedSchemeConstraintName: ReturnValue = CreateAllowedSchemeConstraint(type); break; case Constraint.CharacterSetConstraintName: ReturnValue = CreateCharacterSetConstraint(type); break; case Constraint.DatabaseConstraintName: ReturnValue = new DatabaseConstraint(); break; case Constraint.DecimalPlacesConstraintName: ReturnValue = CreateDecimalPlacesConstraint(type); break; case Constraint.EncryptedConstraintName: ReturnValue = new EncryptedConstraint(); break; case Constraint.EndpointConstraintName: ReturnValue = CreateEndpointConstraint(type); break; case Constraint.EnumValuesConstraintName: ReturnValue = CreateEnumValuesConstraint(type); break; case Constraint.FileNameConstraintName: ReturnValue = CreateFileNameConstraint(type); break; case Constraint.HostNameConstraintName: ReturnValue = CreateHostnameConstraint(type); break; case Constraint.LengthConstraintName: ReturnValue = CreateLengthConstraint(type); break; case Constraint.LowercaseConstraintName: ReturnValue = CreateLowerCaseConstraint(type); break; case Constraint.MaximumLengthConstraintName: ReturnValue = CreateMaximumLengthConstraint(type); break; case Constraint.MaximumValueConstraintName: ReturnValue = CreateMaximumValueConstraint(type); break; case Constraint.MinimumLengthConstraintName: ReturnValue = CreateMinimumLengthConstraint(type); break; case Constraint.MinimumValueConstraintName: ReturnValue = CreateMinimumValueConstraint(type); break; case Constraint.NullConstraintName: ReturnValue = new NullConstraint(); break; case Constraint.PasswordConstraintName: ReturnValue = CreatePasswordConstraint(type); break; case Constraint.PathConstraintName: ReturnValue = CreatePathConstraint(type); break; case Constraint.RegexConstraintName: ReturnValue = CreateRegexConstraint(type); break; case Constraint.StepConstraintName: ReturnValue = CreateStepConstraint(type); break; case Constraint.TypeConstraintName: ReturnValue = CreateTypeConstraint(type); break; case Constraint.UppercaseConstraintName: ReturnValue = CreateUpperCaseConstraint(type); break; default: // Constraint name is unknown IsConstraintNameUnknown = true; break; } if (ReturnValue == null) { ReturnValue = HandleUnknownConstraint(name, type, IsConstraintNameUnknown); } return ReturnValue; }