public void Ctor_SerializationInfo_Success() { CharacterSetConstraint c = new CharacterSetConstraint(CharacterSetConstraint.CharSet.Ascii); System.IO.MemoryStream Buffer = SerializationHelper.Serialize(c); CharacterSetConstraint c2 = SerializationHelper.Deserialize<CharacterSetConstraint>(Buffer); Assert.AreEqual(Constraint.CharacterSetConstraintName, c2.Name); Assert.AreEqual(CharacterSetConstraint.CharSet.Ascii, c2.CharacterSet); }
public void SetParameters_Success() { CharacterSetConstraint c = new CharacterSetConstraint(); c.SetParametersInternal(new string[] { "Ascii" }, ParameterDataType.String); Assert.AreEqual(CharacterSetConstraint.CharSet.Ascii, c.CharacterSet); }
public void ToString_Success() { CharacterSetConstraint c = new CharacterSetConstraint(CharacterSetConstraint.CharSet.Ascii); Assert.AreEqual("[CharSet(Ascii)]", c.ToString()); }
public void Ctor_String_Success() { CharacterSetConstraint c = new CharacterSetConstraint(CharacterSetConstraint.CharSet.Ascii); Assert.AreEqual(Constraint.CharacterSetConstraintName, c.Name); Assert.AreEqual(CharacterSetConstraint.CharSet.Ascii, c.CharacterSet); }
public void Ctor_Void_Success() { CharacterSetConstraint c = new CharacterSetConstraint(); Assert.AreEqual(Constraint.CharacterSetConstraintName, c.Name); Assert.AreEqual(CharacterSetConstraint.CharSet.Windows1252, c.CharacterSet); }
public void Validate_NoWin_Success() { CharacterSetConstraint c = new CharacterSetConstraint(CharacterSetConstraint.CharSet.Windows1252); IEnumerable<ParameterValidationResult> res = c.Validate("Hello World\nä€φ", ParameterDataType.String, Constants.MemberName); Assert.IsNotNull(res); Assert.IsTrue(res.GetEnumerator().MoveNext()); }
public void Validate_NoAscii_Success() { CharacterSetConstraint c = new CharacterSetConstraint(CharacterSetConstraint.CharSet.Ascii); IEnumerable<ParameterValidationResult> res = c.Validate("Holà!", ParameterDataType.String, Constants.MemberName); Assert.IsNotNull(res); Assert.IsTrue(res.GetEnumerator().MoveNext()); }
public void SetParameters_NoParamsOrInvalid_Error() { CustomAssert.ThrowsException<ConstraintConfigurationException>(() => { CharacterSetConstraint c = new CharacterSetConstraint(); c.SetParametersInternal(new string[0], ParameterDataType.String); }); CustomAssert.ThrowsException<ConstraintConfigurationException>(() => { CharacterSetConstraint c = new CharacterSetConstraint(); c.SetParametersInternal(new string[] { "EBCDIC" }, ParameterDataType.String); }); }