2
0

A.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using Jint.Native;
  3. namespace Jint.Tests.Runtime.Domain
  4. {
  5. public class A
  6. {
  7. public int Call1()
  8. {
  9. return 0;
  10. }
  11. public int Call1(int x)
  12. {
  13. return x;
  14. }
  15. public string Call2(string x)
  16. {
  17. return x;
  18. }
  19. public string Call3(object x)
  20. {
  21. return x.ToString();
  22. }
  23. public string Call4(IPerson x)
  24. {
  25. return x.ToString();
  26. }
  27. public string Call5(Delegate callback)
  28. {
  29. var thisArg = JsValue.Undefined;
  30. var arguments = new JsValue[] { 1, "foo" };
  31. return callback.DynamicInvoke(thisArg, arguments).ToString();
  32. }
  33. public string Call6(Func<JsValue, JsValue[], JsValue> callback)
  34. {
  35. var thisArg = new JsValue("bar");
  36. var arguments = new JsValue[] { 1, "foo" };
  37. return callback(thisArg, arguments).ToString();
  38. }
  39. public bool Call7(string str, Func<string, bool> predicate)
  40. {
  41. return predicate(str);
  42. }
  43. public string Call8(Func<string> predicate)
  44. {
  45. return predicate();
  46. }
  47. public void Call9(Action predicate)
  48. {
  49. predicate();
  50. }
  51. public void Call10(string str, Action<string> predicate)
  52. {
  53. predicate(str);
  54. }
  55. public void Call11(string str, string str2, Action<string, string> predicate)
  56. {
  57. predicate(str, str2);
  58. }
  59. public int Call12(int value, Func<int, int> map)
  60. {
  61. return map(value);
  62. }
  63. }
  64. }