public void PropertyAnnotationsHoldAsExpected(GenerateRequestMessage message, string propertyName, bool expectValid)
 {
     var validator = new DataAnnotationsValidatorFixture().Build();
     var results = validator.Validate(message);
     if (expectValid)
     {
         Assert.True(results.Any(r => r.MemberName != propertyName));
     }
     else
     {
         var propResult = results.Single(r => r.MemberName == propertyName);
         Assert.False(propResult.IsValid);
         Assert.True(propResult.ValidationResults.Any());
     }
 }
 public void ValidateProperty(MyTestType toValidate,
     string propertyToValidate,
     Func<MyTestType, object> valueProvider,
     bool shouldBeValid)
 {
     var validator = new DataAnnotationsValidatorFixture().Build();
     var result = validator.ValidateProperty(toValidate, propertyToValidate, valueProvider(toValidate));
     if (shouldBeValid)
     {
         Assert.True(result.IsValid);
     }
     else
     {
         Assert.False(result.IsValid);
         Assert.True(result.ValidationResults.Any());
     }
 }