コード例 #1
0
        public void Test_CommitTransaction_WhenEmpty_ShouldNotCommitOnAnyDataAccessors()
        {
            //---------------Set up test pack-------------------
            IDataAccessor defaultDataAccessor   = MockRepository.GenerateStub <IDataAccessor>();
            IDataAccessor alternateDataAccessor = MockRepository.GenerateStub <IDataAccessor>();

            MyBO.LoadDefaultClassDef();
            Dictionary <Type, IDataAccessor> dataAccessors = new Dictionary <Type, IDataAccessor>();

            dataAccessors.Add(typeof(MyBO), alternateDataAccessor);
            ITransactionCommitter transactionCommitter = new TransactionCommitterMultiSource(defaultDataAccessor, dataAccessors);

            //---------------Assert Precondition----------------
            defaultDataAccessor.AssertWasNotCalled(accessor => accessor.CreateTransactionCommitter());
            alternateDataAccessor.AssertWasNotCalled(accessor => accessor.CreateTransactionCommitter());
            //---------------Execute Test ----------------------
            transactionCommitter.CommitTransaction();
            //---------------Test Result -----------------------
            defaultDataAccessor.AssertWasNotCalled(accessor => accessor.CreateTransactionCommitter());
            alternateDataAccessor.AssertWasNotCalled(accessor => accessor.CreateTransactionCommitter());
        }