public void GetParametersTest() { // Create call: MockingProxy callee = new MockingProxy(typeof(Sample.FooBar), null, "m1"); MockableCall call = new MockableCall(callee, typeof(Sample.FooBar).GetMethod("SomeMethodWithInsAndOuts"), new object[] { 1, 2, null, 3 }); // Check parameters: Assert.AreEqual(3, call.GetInParameters().Length, "Input parameters count mismatch."); Assert.AreEqual(2, call.GetOutParameters().Length, "Output parameters count mismatch."); }
public void IsInOutParameterTest() { // Create call: MockingProxy callee = new MockingProxy(typeof(Sample.FooBar), null, "m1"); MockableCall call = new MockableCall(callee, typeof(Sample.FooBar).GetMethod("SomeMethodWithInsAndOuts"), new object[] { 1, 2, null, 3 }); // Check in parameters: foreach (global::System.Reflection.ParameterInfo param in call.GetInParameters()) { Assert.IsTrue(call.IsParameterIn(param.Position)); } // Check out parameters: foreach (global::System.Reflection.ParameterInfo param in call.GetOutParameters()) { Assert.IsTrue(call.IsParameterOut(param.Position)); } // All params must be IN, OUT or IN/OUT: foreach (global::System.Reflection.ParameterInfo param in call.Method.GetParameters()) { Assert.IsTrue(call.IsParameterIn(param.Position) || call.IsParameterOut(param.Position)); } }