public void VerifyTransactionClosedDoomedFalse() { ITranEvSink mock = mockRepository.CreateMock <ITranEvSink>(); Expect.Call(() => mock.Handle(null, null)) .Constraints(RhinoIs.Null(), RhinoIs.Matching <TransactionClosedEventArgs>(args => args.IsDoomed == false)); GlobalTransactionManager.TransactionClosed += mock.Handle; ExecuteAtTheEndOfTest(() => GlobalTransactionManager.TransactionClosed -= mock.Handle); mockRepository.ReplayAll(); GlobalTransactionManager.BeginTransaction().Dispose(); }
public void VerifyTransactionClosed() { ITranEvSink mock = mockRepository.CreateMock <ITranEvSink>(); Expect.Call(() => mock.Handle(null, EventArgs.Empty)) .IgnoreArguments() .Callback(new Func <Object, EventArgs, Boolean>((sender, e) => GlobalTransactionManager.TransactionsCount == 0)); GlobalTransactionManager.TransactionClosed += mock.Handle; ExecuteAtTheEndOfTest(() => GlobalTransactionManager.TransactionClosed -= mock.Handle); mockRepository.ReplayAll(); GlobalTransactionManager.BeginTransaction().Dispose(); }
public void VerifyTransactionClosingDoomedTrue() { ITranEvSink mock = mockRepository.CreateMock <ITranEvSink>(); Expect.Call(() => mock.Handle(null, null)) .Constraints(RhinoIs.Null(), RhinoIs.Matching <TransactionClosingEventArgs>(args => args.IsDoomed == true)); GlobalTransactionManager.TransactionClosing += mock.Handle; ExecuteAtTheEndOfTest(() => GlobalTransactionManager.TransactionClosing -= mock.Handle); mockRepository.ReplayAll(); using (GlobalTransactionManager.BeginTransaction()) { GlobalTransactionManager.DoomCurrentTransaction(); } }