public void AccessingPropertiesAndState_AffectsAssociatedRootTransaction()
        {
            Assert.That(_order1LoadedInRootTransaction.State, Is.EqualTo(StateType.Unchanged));
            Assert.That(_order1LoadedInRootTransaction.OrderNumber, Is.EqualTo(1));
            Assert.That(_order1LoadedInRootTransaction.OrderItems, Has.Count.EqualTo(2));

            Assert.That(_rootTransaction.HasChanged(), Is.False);

            _order1LoadedInRootTransaction.OrderNumber = 2;
            _order1LoadedInRootTransaction.OrderItems.Clear();

            Assert.That(_order1LoadedInRootTransaction.State, Is.EqualTo(StateType.Changed));
            Assert.That(_order1LoadedInRootTransaction.OrderNumber, Is.EqualTo(2));
            Assert.That(_order1LoadedInRootTransaction.OrderItems, Is.Empty);

            Assert.That(_rootTransaction.HasChanged(), Is.True);
            Assert.That(GetStateFromTransaction(_order1LoadedInRootTransaction, _rootTransaction), Is.EqualTo(StateType.Changed));
        }
 protected void ExpectCommitValidateEvents(params DomainObject[] domainObjects)
 {
     using (_mockRepository.Ordered())
     {
         ListenerMock
         .Expect(mock => mock.TransactionCommitValidate(Arg.Is(_transaction), ArgIsPersistableDataSet(domainObjects)))
         .WhenCalled(mi => Assert.That(_transaction.HasChanged(), Is.True, "CommitValidate: last event before actual commit."));
         ExtensionMock
         .Expect(mock => mock.CommitValidate(Arg.Is(_transaction), ArgIsPersistableDataSet(domainObjects)));
     }
 }
예제 #3
0
        public void AccessingPropertiesAndState_AffectsActiveLeafTransaction()
        {
            using (_leafTransaction.EnterNonDiscardingScope())
            {
                Assert.That(_order1LoadedInMiddleTransaction.State, Is.EqualTo(StateType.NotLoadedYet));
                Assert.That(_order1LoadedInMiddleTransaction.OrderNumber, Is.EqualTo(1));
                Assert.That(_order1LoadedInMiddleTransaction.OrderItems, Has.Count.EqualTo(2));

                Assert.That(_leafTransaction.HasChanged(), Is.False);

                _order1LoadedInMiddleTransaction.OrderNumber = 2;
                _order1LoadedInMiddleTransaction.OrderItems.Clear();

                Assert.That(_order1LoadedInMiddleTransaction.State, Is.EqualTo(StateType.Changed));
                Assert.That(_order1LoadedInMiddleTransaction.OrderNumber, Is.EqualTo(2));
                Assert.That(_order1LoadedInMiddleTransaction.OrderItems, Is.Empty);

                Assert.That(_rootTransaction.HasChanged(), Is.False);
                Assert.That(_middleTransaction.HasChanged(), Is.False);
                Assert.That(_leafTransaction.HasChanged(), Is.True);
                Assert.That(GetStateFromTransaction(_order1LoadedInMiddleTransaction, _leafTransaction), Is.EqualTo(StateType.Changed));
            }
        }