PageRenderTime 35ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 1ms

/trunk/Examples/test-suite/csharp/director_protected_runme.cs

#
C# | 100 lines | 77 code | 21 blank | 2 comment | 18 complexity | 0a8e8b0ac9c0bb534d7c93a694f29471 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. using System;
  2. namespace director_protectedNamespace {
  3. public class runme
  4. {
  5. static void Main()
  6. {
  7. runme r = new runme();
  8. r.run();
  9. }
  10. void run()
  11. {
  12. Bar b = new Bar();
  13. Foo f = b.create();
  14. FooBar fb = new FooBar();
  15. FooBar2 fb2 = new FooBar2();
  16. FooBar3 fb3 = new FooBar3();
  17. String s;
  18. s = fb.used();
  19. if ( s != ("Foo::pang();Bar::pong();Foo::pong();FooBar::ping();"))
  20. throw new Exception("bad FooBar::used" + " - " + s);
  21. s = fb2.used();
  22. if ( s != ("FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();"))
  23. throw new Exception("bad FooBar2::used");
  24. s = b.pong();
  25. if ( s != ("Bar::pong();Foo::pong();Bar::ping();"))
  26. throw new Exception("bad Bar::pong");
  27. s = f.pong();
  28. if ( s != ("Bar::pong();Foo::pong();Bar::ping();"))
  29. throw new Exception("bad Foo::pong");
  30. s = fb.pong();
  31. if ( s != ("Bar::pong();Foo::pong();FooBar::ping();"))
  32. throw new Exception("bad FooBar::pong");
  33. // if (fb3.cheer() != "FooBar3::cheer();")
  34. // throw new Exception("bad fb3::cheer");
  35. if (fb2.callping() != "FooBar2::ping();")
  36. throw new Exception("bad fb2.callping");
  37. if (fb2.callcheer() != "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();")
  38. throw new Exception("bad fb2.callcheer");
  39. if (fb3.callping() != "Bar::ping();")
  40. throw new Exception("bad fb3.callping");
  41. if (fb3.callcheer() != "FooBar3::cheer();")
  42. throw new Exception("bad fb3.callcheer");
  43. }
  44. }
  45. class FooBar : Bar
  46. {
  47. public FooBar() : base()
  48. {
  49. }
  50. protected override String ping()
  51. {
  52. return "FooBar::ping();";
  53. }
  54. }
  55. class FooBar2 : Bar
  56. {
  57. public FooBar2() : base()
  58. {
  59. }
  60. protected override String ping()
  61. {
  62. return "FooBar2::ping();";
  63. }
  64. protected override String pang()
  65. {
  66. return "FooBar2::pang();";
  67. }
  68. }
  69. class FooBar3 : Bar
  70. {
  71. public FooBar3() : base()
  72. {
  73. }
  74. protected override String cheer()
  75. {
  76. return "FooBar3::cheer();";
  77. }
  78. }
  79. }