private static void InvokeAndAssert(ComplexClass instance) { instance.DoNothing(); instance.DoSomething(); int arg = 1; instance.DoSomething(arg); instance.DoSomething(arg, "hiya"); //TODO: Intercept by ref calls. //Assert.AreEqual(arg, instance.Pong(ref arg)); instance.Name = "John Johnson"; Assert.AreEqual("John Johnson", instance.Name); instance.Started = true; Assert.IsTrue(instance.Started); }
private static void WrapAndInvokeEverything(AspectEngine engine) { ComplexClass instance = engine.WrapClass(typeof(ComplexClass)) as ComplexClass; instance.DoNothing(); instance.DoSomething(); int arg = 1; instance.DoSomething(arg); instance.DoSomething(arg, "hiya"); //TODO: Intercept by ref calls. //Assert.AreEqual(arg, instance.Pong(ref arg)); instance.Name = "John Johnson"; Assert.AreEqual("John Johnson", instance.Name); instance.Started = true; Assert.IsTrue(instance.Started); }
private static void WrapAndInvokeEverything(AspectEngine engine) { long begin = DateTime.Now.Ticks; ComplexClass instance = engine.WrapClass(typeof(ComplexClass)) as ComplexClass; for (int i = 0; i < 10000; i++) { instance.DoNothing(); instance.DoSomething(); instance.DoSomething(1); instance.DoSomething(1, "hiya"); instance.Name = "John Johnson"; Assert.AreEqual("John Johnson", instance.Name); instance.Started = true; Assert.IsTrue(instance.Started); } long end = DateTime.Now.Ticks; long result = (end - begin) / 1000; System.Console.WriteLine("Execution took " + (result).ToString() + " ms "); }