Hi,
It's possible to verify the parameter using DoInstead functionality. When DoInstead is called you can save the parameters you wish to verify against.
For example:
public class UnderTest
{
readonly Random numberGenerator = new Random();
public void PerformAction()
{
int nextRandomNumber = numberGenerator.Next(1,100);
PerformActionWithParameters(1, nextRandomNumber);
}
public void PerformActionWithParameters(int known, int random)
{
}
}
[TestClass]
public class TestClass
{
[TestMethod]
public void PerformAction_ObjectAskedToPerformAction_KnownParameterIsOne()
{
int actualKnown = 0;
var underTest = Isolate.Fake.Instance<UnderTest>(Members.CallOriginal);
Isolate.WhenCalled(() => underTest.PerformActionWithParameters(0, 0))
.DoInstead(context => actualKnown = (int) context.Parameters[0]);
underTest.PerformAction();
Assert.AreEqual(1, actualKnown);
}
}
Please let me know if it helps.
Best Regards,
Elisha
Typemock Support Team