public void Ctor_StringStringString_Success()
		{
			DatabaseConstraint c = new DatabaseConstraint(Constants.EntityName, Constants.KeyName, Constants.DisplayName);
			Assert.AreEqual(Constraint.DatabaseConstraintName, c.Name);
			Assert.AreEqual(Constants.DisplayName, c.DisplayProperty);
			Assert.AreEqual(Constants.EntityName, c.Entity);
			Assert.AreEqual(Constants.KeyName, c.KeyProperty);
		}
		public void Ctor_NullNullNull_Success()
		{
			DatabaseConstraint c = new DatabaseConstraint(null, null, null);
			Assert.AreEqual(Constraint.DatabaseConstraintName, c.Name);
			Assert.AreEqual(string.Empty, c.DisplayProperty);
			Assert.AreEqual(string.Empty, c.Entity);
			Assert.AreEqual(string.Empty, c.KeyProperty);
		}
		public void Ctor_SerializationInfo_Success()
		{
			DatabaseConstraint c = new DatabaseConstraint(Constants.EntityName, Constants.KeyName, Constants.DisplayName);
			System.IO.MemoryStream Buffer = SerializationHelper.Serialize(c);
			DatabaseConstraint c2 = SerializationHelper.Deserialize<DatabaseConstraint>(Buffer);

			Assert.AreEqual(Constraint.DatabaseConstraintName, c2.Name);
			Assert.AreEqual(Constants.DisplayName, c2.DisplayProperty);
			Assert.AreEqual(Constants.EntityName, c2.Entity);
			Assert.AreEqual(Constants.KeyName, c2.KeyProperty);
		}
		public void SetParameters_TooManyFewParams_Error()
		{
			CustomAssert.ThrowsException<ConstraintConfigurationException>(() =>
			{
				DatabaseConstraint c = new DatabaseConstraint();
				c.SetParametersInternal(new string[0], ParameterDataType.Int32);
			});
			CustomAssert.ThrowsException<ConstraintConfigurationException>(() =>
			{
				DatabaseConstraint c = new DatabaseConstraint();
				c.SetParametersInternal(new string[] { "1", "2", "3", "4" }, ParameterDataType.Int32);
			});
		}
		public void SetParameters_Null_Success()
		{
			DatabaseConstraint c = new DatabaseConstraint();
			c.SetParametersInternal(new string[] { null, null, null }, ParameterDataType.Int32);
			Assert.AreEqual(string.Empty, c.DisplayProperty);
			Assert.AreEqual(string.Empty, c.Entity);
			Assert.AreEqual(string.Empty, c.KeyProperty);
		}
		public void SetParameters_Success()
		{
			DatabaseConstraint c = new DatabaseConstraint();
			c.SetParametersInternal(new string[] { Constants.EntityName, Constants.KeyName, Constants.DisplayName }, ParameterDataType.Int32);
			Assert.AreEqual(Constants.DisplayName, c.DisplayProperty);
			Assert.AreEqual(Constants.EntityName, c.Entity);
			Assert.AreEqual(Constants.KeyName, c.KeyProperty);
		}
		public void ToString_Success()
		{
			DatabaseConstraint c = new DatabaseConstraint(Constants.EntityName, Constants.KeyName, Constants.DisplayName);
			Assert.AreEqual(string.Format("[Database({0},{1},{2})]", Constants.EntityName, Constants.KeyName, Constants.DisplayName), c.ToString());
		}
		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;
		}