PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

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