Any way we could get an IRuleContext interface? This would make unit testing business rules a bit easier.
Instead of just looking at the Results collection, I could verify that the appropriate AddXYZRule was called. Also, I currently need to make my IPropertyInfo mocks return something or the RuleContext blows up with a NullRefException. Since the correctness of my rule doesn't depend on property names, its just more stuff you need to worry about to test that isn't relevent.
Look at the Net\cs\RuleTutorial sample in trunk and the sample unit tests.
This approach lets you test async and sync rules in the same way.
Jonny, I looked at the sample. I did already figure out what I need to do to make the rule context happy, the point is that it would be easier not having to make it happy by being able to mock an interface. Not having the interface forces test creators to write more code than they'd really need to. Plus if the implementation changes in RuleContext in some future version the tests might break, even though my rule's interaction with the RuleContext doesn't change. IIRC, IPropertyInfo was added to help people unit test more easiler, this request is along the same lines.
Copyright (c) Marimer LLC