static void Main(string[] args) { MyClass aaa = new MyClass(); aaa.A(); // prints MyClass.A aaa.B(); // prints MyClass.B aaa.Attachment = new ClassA(); aaa.A(); // should print AttachmentA.A <newline> MyClass.A aaa.B(); // should print AttachmentB.B }
public void GetCallingMethod_given_ProperData_should_ReturnCaller() { // # Arrange. var myClass = new MyClass(Meta.GetCallingMethod); // # Act. myClass.A(); // # Assert. Assert.AreEqual("A", myClass.MyMethodBase.Name); }
public void GetCallingMethod_given_ProperData_should_ReturnCaller() { // # Arrange. var myClass = new MyClass(Meta.GetCallingMethod); // # Act. myClass.A(); // # Assert. myClass.MyMethodBase.Name.Should().Be("A"); }
static void Main() { MyClass MCls = new MyClass(); try { MCls.A(); } catch (DivideByZeroException e) { Console.WriteLine("catch clause in Main()"); } finally { Console.WriteLine("finally clause in Main()"); } Console.WriteLine("After try statement in Main()"); Console.WriteLine(" ----- keep running"); }