private void Validate(Func <TestTag, ITagAttribute> action, TagException expectedException) { // Given var tag = CreateTag(action); var validator = new BooleanTagAttributeValidator(); // When TagException result = null; try { validator.Validate(tag); } catch (TagException e) { result = e; } Assert.That(result?.Message, Is.EqualTo(expectedException?.Message), tag.BooleanValue?.ToString()); }
public void Should_validate_tagAttributes_with_enum() { Validate(tag => new ConstantAttribute("true", tag), null); Validate(tag => new ConstantAttribute("waar", tag), BooleanTagAttributeValidator.InvalidValue("BooleanValue", "waar")); Validate(tag => null, null); }