public void InValidLessThanCompare() { var AValidator = new DataValidation.Validator(); var SameDateA = DateTime.Parse("03/05/2020"); var SameDateB = DateTime.Parse("03/05/2020"); var SameDateC = DateTime.Parse("03/04/2020"); AValidator.AddField("CreatedDate", SameDateA, "CreatedDateComfirm", SameDateB, "LessThanCompare"); AValidator.AddField("CreatedDate", SameDateA, "CreatedDateComfirm", SameDateC, "LessThanCompare"); AValidator.AddField("CreatedDate", (DateTime?)null, "CreatedDateComfirm", (DateTime?)null, "LessThanCompare"); AValidator.AddField("CreatedDate", SameDateA, "CreatedDateComfirm", (DateTime?)null, "LessThanCompare"); AValidator.AddField("CreatedDate", (DateTime?)null, "CreatedDateComfirm", SameDateB, "LessThanCompare"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 5); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void ValidIsDate() { var AValidator = new DataValidation.Validator(); AValidator.AddField("AmountDue", "12/30/2020", "IsDate(MM/dd/yyyy)"); AValidator.AddField("AmountDue", "1/2/2020", "IsDate(M/d/yyyy)"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidEmail() { var AValidator = new DataValidation.Validator(); AValidator.AddField("User Email", "*****@*****.**", "IsEmail"); AValidator.AddField("User Email", "*****@*****.**", "IsEmail"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidAreNotEqual() { var AValidator = new DataValidation.Validator(); AValidator.AddField("AccountId", (long?)1234, "AccountIdComfirm", (long?)12345, "AreNotEqual"); AValidator.AddField("AccountId", (long?)null, "AccountIdComfirm", (long?)0, "AreNotEqual"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.IsEmpty(Messages); }
public void ValidGreaterThanCompare() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Age", (long?)22, "AgeComfirm", (long?)21, "GreaterThanCompare"); AValidator.AddField("Age", (long?)22, "AgeComfirm", (long?)-22, "GreaterThanCompare"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.IsEmpty(Messages); }
public void ValidIsCurrency() { var AValidator = new DataValidation.Validator(); AValidator.AddField("AmountDue", "12345", "IsCurrency"); AValidator.AddField("AmountDue", "12345.23", "IsCurrency"); AValidator.AddField("AmountDue", "-12345", "IsCurrency"); AValidator.AddField("AmountDue", "-12345.23", "IsCurrency"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidAreEqual() { var AValidator = new DataValidation.Validator(); var SameDateA = DateTime.Parse("03/02/2020"); var SameDateB = DateTime.Parse("03/02/2020"); AValidator.AddField("CreatedDate", SameDateA, "CreatedDateComfirm", SameDateB, "AreEqual"); AValidator.AddField("CreatedDate", (DateTime?)null, "CreatedDateComfirm", (DateTime?)null, "AreEqual"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.IsEmpty(Messages); }
public void InValidLessthan() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Profile Id", 1235, "LessThan(1234)"); AValidator.AddField("Profile Id", (double?)null, "LessThan(1234)"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 2); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void InValidRequired() { var AValidator = new DataValidation.Validator(); AValidator.AddField("FirstName", "", "Required"); AValidator.AddField("FirstName", " ", "Required"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 2); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void InValidLengthMin() { var AValidator = new DataValidation.Validator(); AValidator.AddField("ZipCode", "1234", "LengthMin(5)"); AValidator.AddField("ZipCode", "", "LengthMin(5)"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 2); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void InValidAreNotEqual() { var AValidator = new DataValidation.Validator(); AValidator.AddField("AccountId", (long?)1234, "AccountIdComfirm", (long?)1234, "AreNotEqual"); AValidator.AddField("AccountId", (long?)null, "AccountIdComfirm", (long?)null, "AreNotEqual"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 2); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void InValidAlphaCharOnly() { var AValidator = new DataValidation.Validator(); AValidator.AddField("StateAbrev", "NY1", "AlphaCharOnly"); AValidator.AddField("StateAbrev", "1NY", "AlphaCharOnly"); AValidator.AddField("StateAbrev", "N1Y", "AlphaCharOnly"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 3); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void InValidExact() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Password", "MyPassword", "PasswordComfirm", "MyPasswordX", "Exact"); AValidator.AddField("Password", "MyPassword", "PasswordComfirm", "mypassword", "Exact"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 2); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void InValidPassword() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Password", "JoeSmith10!", "Password"); AValidator.AddField("Password", "JoeSmit", "Password"); AValidator.AddField("Password", "", "Password"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 3); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void InValidNumbersOnly() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Age", "10a", "NumbersOnly"); AValidator.AddField("Age", "a10", "NumbersOnly"); AValidator.AddField("Age", "1a0", "NumbersOnly"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 3); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void InValidIsUserName() { var AValidator = new DataValidation.Validator(); AValidator.AddField("User Name", "Ramosst7", "IsUserName"); AValidator.AddField("User Name", "ramosstmyuser", "IsUserName"); AValidator.AddField("User Name", "Ramosst7XXXXXXXX", "IsUserName"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 3); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void InValidEmail() { var AValidator = new DataValidation.Validator(); AValidator.AddField("User Email", "ramosst.com", "IsEmail"); AValidator.AddField("User Email", "streven@ramosst", "IsEmail"); AValidator.AddField("User Email", "streven", "IsEmail"); AValidator.AddField("User Email", "@", "IsEmail"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 4); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void ValidPassword() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Password", "RamosSte10", "Password"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidRequired() { var AValidator = new DataValidation.Validator(); AValidator.AddField("FirstName", "Steven", "Required"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidZipCode() { var AValidator = new DataValidation.Validator(); AValidator.AddField("ZipCode", "12345", "Required;NumOnly;LengthMin(5);LengthMax(5)"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidEqual() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Profile Id", (long?)1234, "Equal(1234)"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidAlphaNumericOnly() { var AValidator = new DataValidation.Validator(); AValidator.AddField("UniqueProfileId", "12345abcd", "AlphaNumericOnly"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidAreEqual() { var AValidator = new DataValidation.Validator(); AValidator.AddField("AccountId", "ABC123", "AccountIdComfirm", "ABC123", "AreEqual"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.IsEmpty(Messages); }
public void InValidRange() { var AValidator = new DataValidation.Validator(); AValidator.AddField("RemainderBalance", (double?)0, "Range(1,10)"); AValidator.AddField("RemainderBalance", (double?)11, "Range(1,10)"); AValidator.AddField("RemainderBalance", (double?)-1, "Range(1,10)"); AValidator.AddField("RemainderBalance", (double?)1, "Range(-10,-1)"); AValidator.AddField("RemainderBalance", (double?)null, "Range(1,10)"); var Messages = AValidator.Validate(); WriteToConsole(Messages); Assert.AreEqual(Messages.Count, 5); Messages.ForEach(delegate(DataValidation.IValidationMessage message) { StringAssert.DoesNotContain(message.ErrorMessage, message.FieldName); }); }
public void ValidLessthan() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Profile Id", (double?)1232, "LessThan(1234)"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidRequired() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Profile Id", (double)12345, "Required"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidAlphaCharOnly() { var AValidator = new DataValidation.Validator(); AValidator.AddField("StateAbrev", "Ny", "AlphaCharOnly"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidUserName() { var AValidator = new DataValidation.Validator(); AValidator.AddField("User Name", "Ramosst70", "IsUserName"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidNumbersOnly() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Age", "10", "NumbersOnly"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }
public void ValidGreaterthan() { var AValidator = new DataValidation.Validator(); AValidator.AddField("Profile Id", (long)1236, "GreaterThan(1234)"); var Messages = AValidator.Validate(); Assert.IsEmpty(Messages); WriteToConsole(Messages); }