pose
pose copied to clipboard
Question - correct syntaxes
I have 2 use cases that are not immediately clear from the description:
-
Replacing multiple methods (both static and instance). Do i keep creating Shims for each of the methods, and pass a bunch of them to pose context?
-
Replacing a method with
params
argument.
-
You'll have to create shims for each static/instance method (and each overload as well) and pass the bunch to
PoseContext
. -
You can simply pass an array in place of the
params
arguments
E.g.
class Program
{
public void TakesParams(params string[] them)
{
// Do Stuff
}
}
Shim shim = Shim.Replace(() => Is.A<Program>().TakesParams(Is.A<string[]>())).With((Program @this, string[] them) => Console.WriteLine(them.Length));