public void GlobalsCanAddAspectInterfaces() { IAddedGlobalInterface agi = (IAddedGlobalInterface)factory.GetObject("autoInvoker"); Assert.IsTrue(agi.GlobalsAdded == -1); ProxyFactoryObject pfb = (ProxyFactoryObject)factory.GetObject("&validGlobals"); pfb.GetObject(); // for creation Assert.AreEqual(2, pfb.Advisors.Count, "Proxy should have 1 global and 1 explicit advisor"); Assert.AreEqual(1, pfb.Introductions.Count, "Proxy should have 1 global introduction"); agi.GlobalsAdded = ((IAdvised)agi).Introductions.Count; Assert.IsTrue(agi.GlobalsAdded == 1); IApplicationEventListener l = (IApplicationEventListener)factory.GetObject("validGlobals"); agi = (IAddedGlobalInterface)l; Assert.IsTrue(agi.GlobalsAdded == -1); Assert.Throws <InvalidCastException>(() => factory.GetObject <IAddedGlobalInterface>("test1")); }
public IApplicationEventService RegisterApplicationEventListener(IApplicationEventListener listener) { this.listenerList.Add(listener); return this; }