public static void Entry() { var cls = new Sub3(); Inf inf = cls; int a = inf.getWidth(); a = inf.getHeight(); Sub1 t2d = cls; a = t2d.getWidth(); a = t2d.getHeight(); }
static void Main(string[] args) { while (true) { Console.WriteLine("" + "Choose Implementation:\n" + "1)Echo\n" + "2)EchoNotify\n" + "3)EchoNotifyBinding\n" + "4)EchoNotifyBindingAlternating"); var imput = Console.ReadLine(); int caseswitch; if (imput == "q") { return; } else if (imput == "1" || imput == "2" || imput == "3" || imput == "4") { caseswitch = int.Parse(imput); switch (caseswitch) { case (1): Sub1.Run(); break; case (2): Sub2.Run(); break; case (3): Sub3.Run(); break; case (4): Sub4.Run(); break; } } else { Console.WriteLine("invlaid keypress"); } } }
public void IfIsATest() { Base s1 = new Sub1(); Base s2 = new Sub2(); Base s3 = new Sub3(); s1.IfIsA((Sub1 s) => { s.Value = 2; }); Assert.AreEqual(2, ((Sub1)s1).Value); s2.IfIsA((Sub1 s) => { s.Value = 3; }); Assert.AreEqual(42, ((Sub2)s2).Value); Assert.AreEqual(2, s1.IfIsA((Sub1 s) => s.Value)); Assert.AreEqual(0, s1.IfIsA((Sub2 s) => s.Value)); Assert.AreEqual(2, s1.IfIsA((Sub1 s) => s.Value, (Sub2 s) => s.Value)); Assert.AreEqual(42, s2.IfIsA((Sub1 s) => s.Value, (Sub2 s) => s.Value)); Assert.AreEqual(0, s3.IfIsA((Sub1 s) => s.Value, (Sub2 s) => s.Value)); }
public static void Entry() { Inf inf = new Sub3(); inf.Foo(); }