Hi Remco,
Thanks for the speedy reply! Yes, I'm referring to the 'Run impacted tests automatically, others manually' mode. That is handy as we have 10's of thousands of tests and running them all is time consuming and just isn't necessary .... but it does help to warm my office in the winter months ;)
I triple checked just now and you're are right... The tests were in sync with the state of the code and I modified the metadata class and NCrunch rightfully picked up on the changes and ran only the impacted tests (and the results were correct). For whatever reason this wasn't the case earlier today... and then I remember at one point I was using an extension method to group and reuse common validation rules (like below). I played with modifying the extension method and the test results remained in sync....
If anything comes to mind as to what may have happened let me know ...but otherwise it looks like it's working as expected again. I'll just keep an eye out for it try to pin it down better next time. What's odd is I even did a 'resync, rebuild, and run all' earlier today and the issues remained.
public MyViewModelMetadata
{
public override void BuildMetadata(MetadataBuilder<MyViewModel> builder)
{
builder.Property(x => x.Total).CannotBeNegativeAndShouldNotBeZero();
}
}
... then in an extensions class I have the method
public static void CannotBeNegativeOrZero<T, TProperty>(this PropertyMetadataBuilder<T, TProperty> builder)
where TProperty : IComparable
{
builder.MatchesRule(x => !x.Equals(0.00), () => "{0} cannot be zero.").MatchesRule(x => Convert.ToDouble(x) > 0.00, () => "{0} cannot be negative.");
}