本文整理汇总了C#中TestService.GetClass方法的典型用法代码示例。如果您正苦于以下问题:C# TestService.GetClass方法的具体用法?C# TestService.GetClass怎么用?C# TestService.GetClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestService
的用法示例。
在下文中一共展示了TestService.GetClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VariableArguments
public void VariableArguments()
{
TestService service = new TestService();
Method method = service.GetClass().FindMethodByName("VarMethod");
object[] args = new object[] { 1, 2, 3, 4 };
object[] invokeArgs = method.TransposeVariableArguments(args);
Assert.AreEqual(1, invokeArgs.Length);
Assert.AreEqual(args, invokeArgs[0]);
}
示例2: FixedAndVariableArguments
public void FixedAndVariableArguments()
{
TestService service = new TestService();
Method method = service.GetClass().FindMethodByName("FixedVarMethod");
object[] args = new object[] { 1, 2, 3, 4 };
args = method.TransposeVariableArguments(args);
Assert.AreEqual(3, args.Length);
Assert.AreEqual(1, args[0]);
Assert.AreEqual(2, args[1]);
Assert.AreEqual(new object[] { 3, 4 }, args[2]);
}
示例3: FailedMethodYieldsInvocationException
public void FailedMethodYieldsInvocationException()
{
try
{
TestService service = new TestService();
service.GetClass().GetMethodByName("BadMethod").Invoke(service, null, null);
Assert.Fail("Expecting an exception.");
}
catch (TargetMethodException e)
{
Assert.IsTrue(e.InnerException.GetType() == typeof(ApplicationException), "Unexpected inner exception ({0}).", e.InnerException.GetType().FullName);
}
}
示例4: Bug8131
public void Bug8131()
{
//
// Bug #8131: Varargs transposition when last arg is collection
// http://developer.berlios.de/bugs/?func=detailbug&bug_id=8131&group_id=4638
//
TestService service = new TestService();
Method method = service.GetClass().FindMethodByName("VarMethod");
object[] args = new object[] { 1, 2, new int[] { 3, 4 } };
args = method.TransposeVariableArguments(args);
Assert.AreEqual(1, args.Length);
object[] varargs = (object[]) args[0];
Assert.AreEqual(3, varargs.Length);
Assert.AreEqual(1, varargs[0]);
Assert.AreEqual(2, varargs[1]);
Assert.AreEqual(new int[] { 3, 4 }, varargs[2]);
}
示例5: Bug8148
public void Bug8148()
{
//
// Bug #8148: Varargs transposition drops args
// http://developer.berlios.de/bugs/?func=detailbug&bug_id=8148&group_id=4638
//
TestService service = new TestService();
Method method = service.GetClass().FindMethodByName("FixedVarMethod");
object[] args = new object[] { 1, 2,
new int[] { 3, 4 },
new JsonObject(new string[] { "five", "six" }, new object[] { 5, 6 }) };
args = method.TransposeVariableArguments(args);
Assert.AreEqual(3, args.Length);
Assert.AreEqual(1, args[0]);
Assert.AreEqual(2, args[1]);
object[] varargs = (object[]) args[2];
Assert.AreEqual(2, varargs.Length);
Assert.AreEqual(new int[] { 3, 4 }, varargs[0]);
JsonObject o = (JsonObject) varargs[1];
Assert.AreEqual(5, o["five"]);
Assert.AreEqual(6, o["six"]);
}