public void Ctor_SerializationInfo_Success() { DecimalPlacesConstraint c = new DecimalPlacesConstraint(); System.IO.MemoryStream Buffer = SerializationHelper.Serialize(c); DecimalPlacesConstraint c2 = SerializationHelper.Deserialize<DecimalPlacesConstraint>(Buffer); Assert.AreEqual(Constraint.DecimalPlacesConstraintName, c2.Name); Assert.AreEqual(2, c2.DecimalPlaces); }
public void ToString_Success() { DecimalPlacesConstraint c = new DecimalPlacesConstraint(1); Assert.AreEqual("[DecimalPlaces(1)]", c.ToString()); }
public void Validate_Success() { DecimalPlacesConstraint c = new DecimalPlacesConstraint(); IEnumerable<ParameterValidationResult> result = c.Validate(42m, ParameterDataType.Decimal, Constants.MemberName); Assert.IsNotNull(result); List<ParameterValidationResult> Temp = new List<ParameterValidationResult>(result); Assert.AreEqual(0, Temp.Count); }
public void Ctor_Int_Success() { DecimalPlacesConstraint c = new DecimalPlacesConstraint(0); Assert.AreEqual(Constraint.DecimalPlacesConstraintName, c.Name); Assert.AreEqual(0, c.DecimalPlaces); }
public void SetParameters_ParamInv_Error() { CustomAssert.ThrowsException<ConstraintConfigurationException>(() => { DecimalPlacesConstraint c = new DecimalPlacesConstraint(); c.SetParametersInternal(new string[] { "narf" }, ParameterDataType.Decimal); }); }
public void SetParameters_Success() { DecimalPlacesConstraint c = new DecimalPlacesConstraint(); c.SetParametersInternal(new string[] { "1" }, ParameterDataType.Decimal); Assert.AreEqual(1, c.DecimalPlaces); }