Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        public void TestEndedEventAfterSubscription()
        {
            TestTransaction test = new TestTransaction();

            ITransactionSubscriber mockedSubscriber = mockSubscriber(test);

            Expect.Once.On(mockedSubscriber).
            Method("Ended").
            WithAnyArguments();

            test.End();

            this.mockery.VerifyAllExpectationsHaveBeenMet();
        }
Exemplo n.º 3
0
        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();
            }
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
 public RedisBroker(IOptions <RedisBrokerOptions> options, ITransactionSubscriber transactionSubscriber)
 {
     _iOptions = options;
     _iTransactionSubscriber = transactionSubscriber;
 }