public override void SetUp()
 {
     base.SetUp();
     _orderHandle1        = DomainObjectIDs.Order1.GetHandle <Order>();
     _orderHandle2        = DomainObjectIDs.Order2.GetHandle <Order> ();
     _notFoundOrderHandle = new ObjectID(typeof(Order), Guid.NewGuid()).GetHandle <Order>();
     _clientTransaction   = ClientTransaction.CreateRootTransaction();
 }
 public override void SetUp()
 {
     base.SetUp();
     DomainObjectsConfiguration.SetCurrent(TableInheritanceConfiguration.Instance.GetDomainObjectsConfiguration());
     MappingConfiguration.SetCurrent(TableInheritanceConfiguration.Instance.GetMappingConfiguration());
     ConfigurationWrapper.SetCurrent(null);
     _transactionScope = ClientTransaction.CreateRootTransaction().EnterDiscardingScope();
 }
Exemplo n.º 3
0
        public override void SetUp()
        {
            base.SetUp();

            ClientTransaction.CreateRootTransaction().EnterNonDiscardingScope();

            _filter = new AccessControlEntryPropertiesEnumerationValueFilter();
        }
Exemplo n.º 4
0
        public void GetAllObjects_DifferentTransaction()
        {
            var transaction = ClientTransaction.CreateRootTransaction();
            var result      = _service.GetAllObjects(transaction, typeof(SampleBindableDomainObject));

            Assert.That(transaction.IsEnlisted((DomainObject)result[0]), Is.True);
            Assert.That(ClientTransaction.Current.IsEnlisted((DomainObject)result[0]), Is.False);
        }
Exemplo n.º 5
0
 public void InsertRelatedObject_FailsWithItemFromOtherHierarchy()
 {
     using (_leafTransaction.EnterNonDiscardingScope())
     {
         var orderItemFromOtherHierarchy = ClientTransaction.CreateRootTransaction().ExecuteInScope(() => OrderItem.NewObject());
         _order1LoadedInMiddleTransaction.OrderItems.Add(orderItemFromOtherHierarchy);
     }
 }
 public void ManyToOneRelationToConcreteSingle()
 {
     using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope())
     {
         TIOrder order = DomainObjectIDs.Order.GetObject <TIOrder>();
         Assert.That(order.Customer.ID, Is.EqualTo(DomainObjectIDs.Customer));
     }
 }
Exemplo n.º 7
0
    public override void SetUp ()
    {
      base.SetUp();

      ClientTransaction.CreateRootTransaction().EnterNonDiscardingScope();
      DatabaseFixtures dbFixtures = new DatabaseFixtures();
      dbFixtures.CreateEmptyDomain();
    }
Exemplo n.º 8
0
        public override void SetUp()
        {
            base.SetUp();

            _transaction      = ClientTransaction.CreateRootTransaction();
            _industrialSector = _transaction.ExecuteInScope(() => IndustrialSector.NewObject());
            _order            = _transaction.ExecuteInScope(() => Order.NewObject());
        }
Exemplo n.º 9
0
        public void GetRevision()
        {
            DatabaseFixtures dbFixtures = new DatabaseFixtures();

            dbFixtures.CreateEmptyDomain();

            Assert.That(ClientTransaction.CreateRootTransaction().QueryManager.GetScalar(Revision.GetGetRevisionQuery(new RevisionKey())), Is.Null);
        }
        public void CreateClientTransactionExtensions_SubTransaction()
        {
            var clientTransaction = ClientTransaction.CreateRootTransaction().CreateSubTransaction();

            var result = _factory.CreateClientTransactionExtensions(clientTransaction);

            Assert.That(result, Is.Empty);
        }
        public override void SetUp()
        {
            base.SetUp();

            _rootTransaction = ClientTransaction.CreateRootTransaction();
            _order1LoadedInRootTransaction      = DomainObjectIDs.Order1.GetObject <Order> (_rootTransaction);
            _objectReferenceFromRootTransaction = DomainObjectIDs.Order3.GetObjectReference <Order> (_rootTransaction);
        }
Exemplo n.º 12
0
 private static void InitializeLinq()
 {
     using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope())
     {
         using (StopwatchScope.CreateScope("Initializing Linq took {elapsed:ms} ms."))
             QueryFactory.CreateLinqQuery <Tenant>();
     }
 }
Exemplo n.º 13
0
 private static void ExecuteFirstLinqQuery()
 {
     using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope())
     {
         using (StopwatchScope.CreateScope("Executing first Linq query took {elapsed:ms} ms."))
             QueryFactory.CreateLinqQuery <Position>().ToList();
     }
 }
Exemplo n.º 14
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            DatabaseFixtures dbFixtures = new DatabaseFixtures();

            dbFixtures.CreateAndCommitSecurableClassDefinitionWithStates(ClientTransaction.CreateRootTransaction());
        }
 public override void SetUp()
 {
     base.SetUp();
     _orderID1          = DomainObjectIDs.Order1;
     _objectID2         = DomainObjectIDs.Order2;
     _notFoundObjectID  = new ObjectID(typeof(Order), Guid.NewGuid());
     _clientTransaction = ClientTransaction.CreateRootTransaction();
 }
        /// <summary>
        /// Creates a new root transaction instance. This instance is not yet managed by a scope.
        /// </summary>
        /// <returns>A new root transaction.</returns>
        public ITransaction CreateRootTransaction()
        {
            var transaction = ClientTransaction.CreateRootTransaction();

            OnTransactionCreated(transaction);

            return(transaction.ToITransaction());
        }
        public void EmptyTransport()
        {
            ClientTransaction dataTransaction = ClientTransaction.CreateRootTransaction();
            var transportedObjects            = new TransportedDomainObjects(dataTransaction, new List <DomainObject>());

            Assert.That(transportedObjects.DataTransaction, Is.Not.Null);
            Assert.That(transportedObjects.DataTransaction, Is.SameAs(dataTransaction));
            Assert.That(GetTransportedObjects(transportedObjects), Is.Empty);
        }
 private void ModifyDatabase(Action changer)
 {
     SetDatabaseModifyable();
     using (ClientTransaction.CreateRootTransaction().EnterNonDiscardingScope())
     {
         changer();
         ClientTransaction.Current.Commit();
     }
 }
 public void WxeTransactedFunctionNone()
 {
     using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope())
     {
         ClientTransactionScope originalScope = ClientTransactionScope.ActiveScope;
         new CreateNoneTestTransactedFunction(originalScope).Execute(Context);
         Assert.That(ClientTransactionScope.ActiveScope, Is.SameAs(originalScope));
     }
 }
 public override void SetUp()
 {
     base.SetUp();
     _mockRepository    = new MockRepository();
     _cloner            = new DomainObjectCloner();
     _contextMock       = MockRepository.StrictMock <CloneContext>(Cloner);
     _sourceTransaction = ClientTransaction.CreateRootTransaction();
     _cloneTransaction  = ClientTransaction.CreateRootTransaction();
 }
Exemplo n.º 21
0
        public void TryInstall_Success()
        {
            var transaction = ClientTransaction.CreateRootTransaction();

            var result = _extension.TryInstall(transaction);

            Assert.That(result, Is.True);
            Assert.That(transaction.Extensions, Has.Member(_extension));
        }
Exemplo n.º 22
0
 public void ResetScope()
 {
     ClientTransaction.CreateRootTransaction().EnterNonDiscardingScope();
     Assert.That(ClientTransactionScope.ActiveScope, Is.Not.Null);
     Assert.That(ClientTransactionScope.HasCurrentTransaction, Is.True);
     ClientTransactionScope.ResetActiveScope();
     Assert.That(ClientTransactionScope.ActiveScope, Is.Null);
     Assert.That(ClientTransactionScope.HasCurrentTransaction, Is.False);
 }
 private void ModifyAndCommitInOtherTransaction(ObjectID objectID)
 {
     using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope())
     {
         var domainObject = objectID.GetObject <ClassWithAllDataTypes> ();
         ++domainObject.Int32Property;
         ClientTransaction.Current.Commit();
     }
 }
 public bool GenerateAndExecuteQuery()
 {
     using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope())
     {
         var query       = _queryGenerator();
         var recordCount = query.ToList().Count;
         return(recordCount > 100);
     }
 }
Exemplo n.º 25
0
        public void CreateCloneHull_RegistersDataContainer()
        {
            var transaction = ClientTransaction.CreateRootTransaction();

            _cloner.CloneTransaction = transaction;
            var clone = _cloner.CreateCloneHull(_classWithAllDataTypes);

            Assert.That(clone.GetInternalDataContainerForTransaction(transaction).ClientTransaction, Is.SameAs(transaction));
        }
 private void CleanupClientWithNonExistingParentClient(ObjectID clientID)
 {
     using (ClientTransaction.CreateRootTransaction().EnterDiscardingScope())
     {
         var client = clientID.GetObject <Client> ();
         client.Delete();
         ClientTransaction.Current.Commit();
     }
 }
Exemplo n.º 27
0
 public void ClientTransactionCanBeMixed()
 {
     using (MixinConfiguration.BuildFromActive().ForClass(typeof(ClientTransaction)).Clear().AddMixins(typeof(InvertingClientTransactionMixin)).EnterScope())
     {
         ClientTransaction mixedTransaction = ClientTransaction.CreateRootTransaction();
         Assert.That(mixedTransaction, Is.Not.Null);
         Assert.That(Mixin.Get <InvertingClientTransactionMixin> (mixedTransaction), Is.Not.Null);
     }
 }
Exemplo n.º 28
0
        public void CheckIfRightTransaction_Fails()
        {
            var order = Order.NewObject();

            using (ClientTransaction.CreateRootTransaction().EnterNonDiscardingScope())
            {
                DomainObjectCheckUtility.CheckIfRightTransaction(order, ClientTransaction.Current);
            }
        }
Exemplo n.º 29
0
        public override void SetUp()
        {
            base.SetUp();

            _dataContainer = DataContainer.CreateNew(DomainObjectIDs.Order1);
            _dataContainer.SetDomainObject(DomainObjectMother.CreateFakeObject <Order> (_dataContainer.ID));
            ClientTransactionTestHelper.RegisterDataContainer(ClientTransaction.CreateRootTransaction(), _dataContainer);

            _loadedObjectData = new AlreadyExistingLoadedObjectData(_dataContainer);
        }
Exemplo n.º 30
0
        public void SubTransactionInitialize_AddsExtensionToSubTransaction()
        {
            var subTransaction = ClientTransaction.CreateRootTransaction();

            _testHelper.AddExtension(_extension);

            _extension.SubTransactionInitialize(_testHelper.Transaction, subTransaction);

            Assert.That(subTransaction.Extensions[_extension.Key], Is.SameAs(_extension));
        }