Esempio n. 1
0
        public void ReleaseTransaction()
        {
            using (_mockRepository.Ordered())
            {
                _childTransactionMock.Expect(mock => mock.Release());
                _outerTransactionStrategyMock.Expect(mock => mock.UnregisterChildTransactionStrategy(_strategy));
            }
            _mockRepository.ReplayAll();

            PrivateInvoke.InvokeNonPublicMethod(_strategy, "ReleaseTransaction");

            _mockRepository.VerifyAll();
        }
Esempio n. 2
0
        public void EnsureCompatibility()
        {
            var expectedObjects = new[] { new object() };

            _outerTransactionStrategyMock.Expect(mock => mock.EnsureCompatibility(expectedObjects));

            _strategy.EnsureCompatibility(expectedObjects);

            _executionContextMock.VerifyAllExpectations();
            _outerTransactionStrategyMock.VerifyAllExpectations();
        }
Esempio n. 3
0
        public void Test_WithTransactionStrategy()
        {
            ITransactionMode        transactionModeMock     = _mockRepository.StrictMock <ITransactionMode>();
            TestFunction2           function                = new TestFunction2(transactionModeMock);
            TransactionStrategyBase transactionStrategyMock = MockRepository.GenerateMock <TransactionStrategyBase>();

            transactionModeMock.Expect(mock => mock.CreateTransactionStrategy(function, _context)).Return(transactionStrategyMock);
            transactionStrategyMock.Expect(mock => mock.CreateExecutionListener(Arg <IWxeFunctionExecutionListener> .Is.NotNull))
            .Return(_executionListenerMock);

            using (_mockRepository.Ordered())
            {
                _executionListenerMock.Expect(mock => mock.OnExecutionPlay(_context));
                _executionListenerMock.Expect(mock => mock.OnExecutionStop(_context));
            }

            _mockRepository.ReplayAll();

            function.Execute(_context);

            _mockRepository.VerifyAll();
            Assert.That(function.ExecutionListener, Is.SameAs(_executionListenerMock));
        }