コード例 #1
0
        public void StartTransaction_Not_EndTransaction()
        {
            var clientId = 101;

            _undoStackManager.CreateStackForClient(clientId);
            var undoStack = _undoStackManager.GetStackOfClient(clientId);

            _transactionService.StartTransaction(clientId);

            _transactionService.Add(
                new Change(ChangeReason.InsertAt, 1, new TestObject())
                , clientId);

            Assert.AreEqual(0, undoStack.UndoStackCount);
        }
コード例 #2
0
        public Transaction StartTransaction(int clientId, string description)
        {
            lock (myLock)
            {
                _undoStackManager.CreateStackForClient(clientId);

                return(_transactionService.StartTransaction(clientId, description));
            }
        }
コード例 #3
0
        public void No_EndTransaction_EventsRaisedTest()
        {
            var clientId = 101;

            _undoStackManager.CreateStackForClient(clientId);
            var undoStack = _undoStackManager.GetStackOfClient(clientId);

            int eventsRaised = 0;

            undoStack.ActiveStateChanged += (sender, changeSet) =>
            {
                eventsRaised++;
            };

            _transactionService.StartTransaction(clientId);

            _transactionService.Add(
                new Change(ChangeReason.InsertAt, 1, new TestObject())
                , clientId);


            Assert.AreEqual(0, eventsRaised);
        }