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