public void MinMax_02() { var sut = new LengthDoc { MinMaxStringList = new List <string> { "are", "aaa", "ddddd" } }; Aver.IsNull(sut.Validate()); sut.MinMaxStringList = new List <string> { "1", "2", "3", "4", "5", "6", "7", "8" }; var ve = sut.Validate() as FieldValidationException; Aver.AreEqual(nameof(LengthDoc.MinMaxStringList), ve.FieldName); ve.ClientMessage.See(); Aver.IsTrue(ve.ClientMessage.Contains("exceeds max length of 7")); sut.MinMaxStringList = new List <string> { "1" }; ve = sut.Validate() as FieldValidationException; Aver.AreEqual(nameof(LengthDoc.MinMaxStringList), ve.FieldName); ve.ClientMessage.See(); Aver.IsTrue(ve.ClientMessage.Contains("shorter than min length of 3")); }
public void Min_01() { var sut = new LengthDoc { MinString = "a234" }; Aver.IsNull(sut.Validate()); sut.MinString = "1"; var ve = sut.Validate() as FieldValidationException; Aver.AreEqual(nameof(LengthDoc.MinString), ve.FieldName); ve.ClientMessage.See(); Aver.IsTrue(ve.ClientMessage.Contains("shorter than min length of 3")); }
public void Max_01() { var sut = new LengthDoc { MaxString = "are" }; Aver.IsNull(sut.Validate()); sut.MaxString = "areitpie[it[perip"; var ve = sut.Validate() as FieldValidationException; Aver.AreEqual(nameof(LengthDoc.MaxString), ve.FieldName); ve.ClientMessage.See(); Aver.IsTrue(ve.ClientMessage.Contains("exceeds max length of 3")); }
public void Min_03() { var sut = new LengthDoc { MinStringArray = new [] { "a", "2", "3", "4", "5", "6", "7", "8" } }; Aver.IsNull(sut.Validate()); sut.MinStringArray = new [] { "a" }; var ve = sut.Validate() as FieldValidationException; Aver.AreEqual(nameof(LengthDoc.MinStringArray), ve.FieldName); ve.ClientMessage.See(); Aver.IsTrue(ve.ClientMessage.Contains("shorter than min length of 7")); }
public void Max_03() { var sut = new LengthDoc { MaxStringArray = new[] { "a", "d", "dferfr" } }; Aver.IsNull(sut.Validate()); sut.MaxStringArray = new [] { "a", "d", "dferfr", "aa" }; var ve = sut.Validate() as FieldValidationException; Aver.AreEqual(nameof(LengthDoc.MaxStringArray), ve.FieldName); ve.ClientMessage.See(); Aver.IsTrue(ve.ClientMessage.Contains("exceeds max length of 3")); }
public void Any() { var sut = new LengthDoc { }; Aver.IsNull(sut.Validate()); sut.AnyString = " joijwoijedojiweoijdiwejlfgjl;djgl;kjdlk;gjldkjflgkjldkjfglkdfjlgjklfd "; Aver.IsNull(sut.Validate()); sut.AnyStringList = new List <string> { "a", "b", "c", "d", "e", "a", "b", "c", "d", "e" }; Aver.IsNull(sut.Validate()); sut.AnyStringArray = new [] { "a", "b", "c", "d", "e", "a", "b", "c", "d", "e" }; Aver.IsNull(sut.Validate()); }