/// <summary>Mocks a subscriber for the events of a transaction</summary> /// <param name="transaction">Transaction to mock an event subscriber for</param> /// <returns>The mocked event subscriber</returns> private ITransactionSubscriber mockSubscriber(Transaction transaction) { ITransactionSubscriber mockedSubscriber = this.mockery.NewMock <ITransactionSubscriber>(); transaction.AsyncEnded += new EventHandler(mockedSubscriber.Ended); return(mockedSubscriber); }
public void TestEndedEventAfterSubscription() { TestTransaction test = new TestTransaction(); ITransactionSubscriber mockedSubscriber = mockSubscriber(test); Expect.Once.On(mockedSubscriber). Method("Ended"). WithAnyArguments(); test.End(); this.mockery.VerifyAllExpectationsHaveBeenMet(); }
public void TestUnsubscribeInEndedCallback() { TestTransaction monitored = new TestTransaction(); UnsubscribingTransaction test = new UnsubscribingTransaction(monitored); ITransactionSubscriber mockedSubscriber = mockSubscriber(monitored); try { Expect.Once.On(mockedSubscriber).Method("Ended").WithAnyArguments(); monitored.End(); this.mockery.VerifyAllExpectationsHaveBeenMet(); } finally { test.End(); } }
public void TestEndedEventDuingSubscription() { TestTransaction test = new TestTransaction(); test.End(); ITransactionSubscriber mockedSubscriber = this.mockery.NewMock <ITransactionSubscriber>(); Expect.Once.On(mockedSubscriber). Method("Ended"). WithAnyArguments(); test.AsyncEnded += new EventHandler(mockedSubscriber.Ended); this.mockery.VerifyAllExpectationsHaveBeenMet(); }
public RedisBroker(IOptions <RedisBrokerOptions> options, ITransactionSubscriber transactionSubscriber) { _iOptions = options; _iTransactionSubscriber = transactionSubscriber; }