Hi,
Please note that I talked to the development guys and they said that this classes API are liable to change in a future release.
Anyway here is a small example:
This class can be used with the ParameterCheckerEx delegate.
public static bool Check(ParameterCheckerEventArgs args)
{
// our parameter should be > 4.
if ((int)arg.ArgumentValue > 4)
{
return true;
}
// Display a validation error.
//
// Make a formated message that should look like:
// in TestedClass.MyMethod parameter 1
// expected: Greater then 4
// but was: <value>
VerifyMessageBuilder builder =
new VerifyMessageBuilder(string.Empty,null);
builder.SetMessage(args," Greater then",4,args.ArgumentValue);
return false;
}
[Test]
public void ParameterChecker()
{
// Mock our class
Mock mock = MockManager.Mock(typeof(TestedClass));
// Set Expectations
mock.ExpectCall("MyMethod").Args(new
ParameterCheckerEx(Check));
...
}