public void ActivityDTO_ValidateRules_NullRuleSet_ReturnsTrue() { //------------Setup for test-------------------------- var activityDTO = new ActivityDTO(); //------------Execute Test--------------------------- var validate = activityDTO.Validate("FieldName", (IRuleSet)null); //------------Assert Results------------------------- Assert.IsTrue(validate); }
public void ActivityDTO_Validate_GivenNoRules_ReturnTrue() { //------------Setup for test-------------------------- var activityDTO = new ActivityDTO(); //------------Execute Test--------------------------- var isValid = activityDTO.Validate("FieldName", new RuleSet()); //------------Assert Results------------------------- Assert.IsTrue(isValid); }
public void ActivityDTO_FieldName_ValidatesForErrors_ReturnsError() { //------------Setup for test-------------------------- var activityDTO = new ActivityDTO(); activityDTO.FieldName = "1"; //------------Execute Test--------------------------- activityDTO.Validate(() => activityDTO.FieldName, ""); //------------Assert Results------------------------- Assert.AreEqual(1, activityDTO.Errors.Count); }
public void ActivityDTO_Validate_Executed_SetErrorsProperty() { //------------Setup for test-------------------------- var activityDTO = new ActivityDTO { FieldName = null }; var ruleSet = new RuleSet(); ruleSet.Add(new IsNullRule(() => activityDTO.FieldName)); //------------Execute Test--------------------------- activityDTO.Validate("FieldName", ruleSet); //------------Assert Results------------------------- Assert.AreEqual(1, activityDTO.Errors.Count); }
public void ActivityDTO_Validate_GivenRules_HasPassingRuleReturnTrue() { //------------Setup for test-------------------------- var activityDTO = new ActivityDTO { FieldName = "FeildName" }; var ruleSet = new RuleSet(); ruleSet.Add(new IsNullRule(() => activityDTO.FieldName)); //------------Execute Test--------------------------- var isValid = activityDTO.Validate("FieldName", ruleSet); //------------Assert Results------------------------- Assert.IsTrue(isValid); }
public void ActivityDTO_Validate_GivenRules_HasPassingRuleReturnTrue() { //------------Setup for test-------------------------- var activityDTO = new ActivityDTO { FieldName = "FeildName" }; var ruleSet = new RuleSet(); ruleSet.Add(new IsNullRule(() => activityDTO.FieldName)); //------------Execute Test--------------------------- bool isValid = activityDTO.Validate("FieldName", ruleSet); //------------Assert Results------------------------- Assert.IsTrue(isValid); }
public void ActivityDTO_Validate_GivenNoRules_ReturnTrue() { //------------Setup for test-------------------------- var activityDTO = new ActivityDTO(); //------------Execute Test--------------------------- bool isValid = activityDTO.Validate("FieldName", new RuleSet()); //------------Assert Results------------------------- Assert.IsTrue(isValid); }