public void Ctor_StringEmpty_Error() { CustomAssert.ThrowsException<CodedArgumentNullOrWhiteSpaceException>(() => { DisplayHintConstraint c = new DisplayHintConstraint(string.Empty); }); }
public void Ctor_IEnumerableString_Success() { DisplayHintConstraint c = new DisplayHintConstraint(Constants.SchemeNames); Assert.AreEqual(Constraint.DisplayHintConstraintName, c.Name); Assert.IsNotNull(c.Hints); List<string> TempSchemas = new List<string>(c.Hints); Assert.AreEqual(3, TempSchemas.Count); }
public void Ctor_IEnumerableNull_Error() { CustomAssert.ThrowsException<CodedArgumentNullException>(() => { DisplayHintConstraint c = new DisplayHintConstraint((IEnumerable<string>)null); }); }
public void Ctor_Void_Success() { DisplayHintConstraint c = new DisplayHintConstraint(); Assert.AreEqual(Constraint.DisplayHintConstraintName, c.Name); Assert.IsNull(c.Hints); }
public void Validate_Success() { DisplayHintConstraint c = new DisplayHintConstraint(Constants.SchemeNames); 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 SetParameters_NoParamsOrNull_Error() { CustomAssert.ThrowsException<ConstraintConfigurationException>(() => { DisplayHintConstraint c = new DisplayHintConstraint(); c.SetParametersInternal(new string[0], ParameterDataType.String); }); CustomAssert.ThrowsException<ConstraintConfigurationException>(() => { DisplayHintConstraint c = new DisplayHintConstraint(); c.SetParametersInternal(new string[] { "1", "2", null, "4" }, ParameterDataType.String); }); }
public void SetParameters_Success() { DisplayHintConstraint c = new DisplayHintConstraint(); c.SetParametersInternal(new string[] { Constants.SchemeNames[0], Constants.SchemeNames[1], Constants.SchemeNames[2] }, ParameterDataType.String); Assert.IsNotNull(c.Hints); List<string> TempSchemas = new List<string>(c.Hints); Assert.AreEqual(3, TempSchemas.Count); }
public void ToString_Success() { DisplayHintConstraint c = new DisplayHintConstraint(Constants.SchemeNames); Assert.AreEqual(string.Format("[DisplayHint({0},{1},{2})]", Constants.SchemeNames[0], Constants.SchemeNames[1], Constants.SchemeNames[2]), c.ToString()); }
public void Ctor_SerializationInfo_Success() { DisplayHintConstraint c = new DisplayHintConstraint(Constants.SchemeNames); System.IO.MemoryStream Buffer = SerializationHelper.Serialize(c); DisplayHintConstraint c2 = SerializationHelper.Deserialize<DisplayHintConstraint>(Buffer); Assert.AreEqual(Constraint.DisplayHintConstraintName, c2.Name); Assert.IsNotNull(c2.Hints); List<string> TempSchemas = new List<string>(c2.Hints); Assert.AreEqual(3, TempSchemas.Count); }