A.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. public string Call13(params object[] values)
  64. {
  65. return String.Join(",", values);
  66. }
  67. public string Call14(string firstParam, params object[] values)
  68. {
  69. return String.Format("{0}:{1}", firstParam, String.Join(",", values));
  70. }
  71. }
  72. }