public override void SetUp()
        {
            base.SetUp();

            _owningOrder = DomainObjectIDs.Order1.GetObject <Order> ();
            _endPointID  = RelationEndPointID.Resolve(_owningOrder, o => o.OrderItems);

            _collectionEndPointMock = MockRepository.GenerateStrictMock <ICollectionEndPoint>();
            StubCollectionEndPoint(_collectionEndPointMock, TestableClientTransaction, _owningOrder);
            _virtualEndPointProviderStub = MockRepository.GenerateStub <IVirtualEndPointProvider> ();
            _virtualEndPointProviderStub
            .Stub(stub => stub.GetOrCreateVirtualEndPoint(_endPointID))
            .Return(_collectionEndPointMock);

            _endPointDataStub      = MockRepository.GenerateStub <IDomainObjectCollectionData>();
            _endPointDataDecorator = new ReadOnlyCollectionDataDecorator(_endPointDataStub);

            _commandStub       = MockRepository.GenerateStub <IDataManagementCommand>();
            _nestedCommandMock = MockRepository.GenerateMock <IDataManagementCommand> ();
            _nestedCommandMock.Stub(stub => stub.GetAllExceptions()).Return(new Exception[0]);
            _expandedCommandFake = new ExpandedCommand(_nestedCommandMock);

            _delegatingData = new EndPointDelegatingCollectionData(_endPointID, _virtualEndPointProviderStub);

            _orderItem1 = DomainObjectIDs.OrderItem1.GetObject <OrderItem>();
            _orderItem2 = DomainObjectIDs.OrderItem2.GetObject <OrderItem>();

            ClientTransactionScope.EnterNullScope(); // no active transaction
        }
コード例 #2
0
 public void HasCurrentFalseViaNullTransaction()
 {
     using (ClientTransactionScope.EnterNullScope())
     {
         Assert.That(ClientTransactionScope.HasCurrentTransaction, Is.False);
     }
 }
コード例 #3
0
 public void SearchAvailableObjects_NoTransaction()
 {
     using (ClientTransactionScope.EnterNullScope())
     {
         _service.Search(null, _property, new DefaultSearchArguments(_stubbedQueryID));
     }
 }
コード例 #4
0
 public void NullTransaction_ForCloneTransaction()
 {
     using (ClientTransactionScope.EnterNullScope())
     {
         _cloner.CreateValueClone(_boundSource);
     }
 }
コード例 #5
0
 public void ExecuteSingle_NoActiveClientTransaction()
 {
     using (ClientTransactionScope.EnterNullScope())
     {
         _queryExecutor.ExecuteSingle <Order> (_someQueryModel, false);
     }
 }
コード例 #6
0
 public void ExecuteCollection_NoActiveClientTransaction()
 {
     using (ClientTransactionScope.EnterNullScope())
     {
         _queryExecutor.ExecuteCollection <Order> (_someQueryModel);
     }
 }
コード例 #7
0
 public void ExecuteScalar_NoActiveClientTransaction()
 {
     using (ClientTransactionScope.EnterNullScope())
     {
         _queryExecutor.ExecuteScalar <int> (_someQueryModel);
     }
 }
コード例 #8
0
 public void NoAutoInitializationOfCurrent()
 {
     using (ClientTransactionScope.EnterNullScope())
     {
         Assert.That(ClientTransactionScope.HasCurrentTransaction, Is.False);
         Dev.Null = ClientTransactionScope.CurrentTransaction;
     }
 }
コード例 #9
0
 public void Search_NoCurrentTransaction()
 {
     using (ClientTransactionScope.EnterNullScope())
     {
         var property = GetBusinessObjectProperty(typeof(OppositeBidirectionalBindableDomainObject), "OppositeSampleObject");
         _service.Search(null, property, null);
     }
 }
コード例 #10
0
 public void ToCustomCollection_WithoutTransaction()
 {
     using (ClientTransactionScope.EnterNullScope())
     {
         var collection = _resultWithCustomType.ToCustomCollection();
         Assert.That(collection, Is.InstanceOf(typeof(OrderCollection)));
         Assert.That(collection, Is.EqualTo(new[] { _order1, _order3, _order4 }));
     }
 }
コード例 #11
0
 public void EnterNullScopeSetsNullTransaction()
 {
     using (ClientTransaction.CreateRootTransaction().EnterNonDiscardingScope())
     {
         Assert.That(ClientTransactionScope.HasCurrentTransaction, Is.True);
         using (ClientTransactionScope.EnterNullScope())
         {
             Assert.That(ClientTransactionScope.HasCurrentTransaction, Is.False);
         }
         Assert.That(ClientTransactionScope.HasCurrentTransaction, Is.True);
     }
 }
コード例 #12
0
        public void GetOppositeObject()
        {
            RealObjectEndPointTestHelper.SetOppositeObjectID(_endPoint, DomainObjectIDs.Order1);

            DomainObject oppositeObject;

            using (ClientTransactionScope.EnterNullScope())
            {
                oppositeObject = _endPoint.GetOppositeObject();
            }

            Assert.That(oppositeObject, Is.SameAs(LifetimeService.GetObjectReference(TestableClientTransaction, DomainObjectIDs.Order1)));
            Assert.That(oppositeObject.State, Is.EqualTo(StateType.NotLoadedYet), "Data has not been loaded");
        }
コード例 #13
0
        public void ClientTransactionCurrentIdenticalToScopeCurrentButNullOnEmptyScope()
        {
            ClientTransaction clientTransaction1 = ClientTransaction.CreateRootTransaction();
            ClientTransaction clientTransaction2 = ClientTransaction.CreateRootTransaction();

            Assert.That(ClientTransaction.Current, Is.SameAs(ClientTransactionScope.CurrentTransaction));

            using (clientTransaction1.EnterDiscardingScope())
            {
                Assert.That(ClientTransaction.Current, Is.SameAs(ClientTransactionScope.CurrentTransaction));
                using (clientTransaction2.EnterDiscardingScope())
                {
                    Assert.That(ClientTransaction.Current, Is.SameAs(ClientTransactionScope.CurrentTransaction));
                }
                Assert.That(ClientTransaction.Current, Is.SameAs(ClientTransactionScope.CurrentTransaction));
            }
            Assert.That(ClientTransaction.Current, Is.SameAs(ClientTransactionScope.CurrentTransaction));

            using (ClientTransactionScope.EnterNullScope())
            {
                Assert.That(ClientTransaction.Current, Is.Null);
            }
        }