コード例 #1
0
            /// <exception cref="System.Exception"></exception>
            public virtual void TestCommittedCallbacks()
            {
                Lock4        lockObject  = new Lock4();
                BooleanByRef ownEvent    = new BooleanByRef(false);
                BooleanByRef gotEvent    = new BooleanByRef(false);
                BooleanByRef shallListen = new BooleanByRef(false);

                OwnCommittedCallbacksFixture.IContainerFactory factory = ((OwnCommittedCallbacksFixture.IContainerFactory
                                                                           )Factory.Value);
                OwnCommittedCallbacksFixture.CommitAction action = ((OwnCommittedCallbacksFixture.CommitAction
                                                                     )Action.Value);
                factory.Open();
                IObjectContainer clientA  = factory.OpenClient();
                IObjectContainer clientB  = factory.OpenClient();
                IEventRegistry   registry = EventRegistryFactory.ForObjectContainer(clientA);

                registry.Committed += new System.EventHandler <Db4objects.Db4o.Events.CommitEventArgs>
                                          (new _IEventListener4_153(shallListen, gotEvent, ownEvent, lockObject).OnEvent);
                lockObject.Run(new _IClosure4_170(shallListen, action, clientA, clientB, lockObject
                                                  ));
                shallListen.value = false;
                clientB.Close();
                clientA.Close();
                factory.Close();
                Assert.IsTrue(gotEvent.value);
                Assert.AreEqual(action.SelectsFirstClient(), ownEvent.value);
            }
コード例 #2
0
 public _IClosure4_170(BooleanByRef shallListen, OwnCommittedCallbacksFixture.CommitAction
                       action, IObjectContainer clientA, IObjectContainer clientB, Lock4 lockObject)
 {
     this.shallListen = shallListen;
     this.action      = action;
     this.clientA     = clientA;
     this.clientB     = clientB;
     this.lockObject  = lockObject;
 }