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

            _order    = (Order)LifetimeService.GetObjectReference(WriteableSubTransaction, DomainObjectIDs.Order1);
            _location = (Location)LifetimeService.GetObjectReference(WriteableSubTransaction, DomainObjectIDs.Location1);
            _client1  = (Client)LifetimeService.GetObject(WriteableSubTransaction, DomainObjectIDs.Client1, false);
            _client2  = (Client)LifetimeService.GetObject(WriteableSubTransaction, DomainObjectIDs.Client2, false);
            _client3  = (Client)LifetimeService.GetObject(WriteableSubTransaction, DomainObjectIDs.Client3, false);
            _client4  = (Client)LifetimeService.NewObject(WriteableSubTransaction, typeof(Client), ParamList.Empty);

            _loadEventReceiverMock = MockRepository.GenerateStrictMock <ILoadEventReceiver>();
            _order.SetLoadEventReceiver(_loadEventReceiverMock);
            _location.SetLoadEventReceiver(_loadEventReceiverMock);
        }
Beispiel #2
0
        public override void SetUp()
        {
            base.SetUp();

            _clientTransaction = ClientTransaction.CreateRootTransaction();

            _eventBroker = new ClientTransactionEventBroker(_clientTransaction);

            _domainObject1       = _clientTransaction.ExecuteInScope(() => DomainObjectIDs.Order1.GetObject <Order> ());
            _domainObject2       = _clientTransaction.ExecuteInScope(() => DomainObjectIDs.Order3.GetObject <Order> ());
            _invalidDomainObject = _clientTransaction.ExecuteInScope(
                () =>
            {
                var order = Order.NewObject();
                order.Delete();
                return(order);
            });

            _mockRepository                 = new MockRepository();
            _order1EventReceiverMock        = _mockRepository.StrictMock <DomainObjectMockEventReceiver> (_domainObject1);
            _order2EventReceiverMock        = _mockRepository.StrictMock <DomainObjectMockEventReceiver> (_domainObject2);
            _invalidObjectEventReceiverMock = _mockRepository.StrictMock <DomainObjectMockEventReceiver> (_invalidDomainObject);

            _unloadEventReceiverMock = _mockRepository.StrictMock <IUnloadEventReceiver> ();
            ((TestDomainBase)_domainObject1).SetUnloadEventReceiver(_unloadEventReceiverMock);
            ((TestDomainBase)_domainObject2).SetUnloadEventReceiver(_unloadEventReceiverMock);

            _transactionEventReceiverMock = _mockRepository.StrictMock <ClientTransactionMockEventReceiver> (_clientTransaction);

            _loadEventReceiverMock = _mockRepository.StrictMock <ILoadEventReceiver> ();
            ((TestDomainBase)_domainObject1).SetLoadEventReceiver(_loadEventReceiverMock);
            ((TestDomainBase)_domainObject2).SetLoadEventReceiver(_loadEventReceiverMock);

            _extensionMock = _mockRepository.StrictMock <IClientTransactionExtension> ();
            _extensionMock.Stub(stub => stub.Key).Return("extension");
            _extensionMock.Replay();
            _eventBroker.Extensions.Add(_extensionMock);
            _extensionMock.BackToRecord();

            _listenerMock = _mockRepository.StrictMock <IClientTransactionListener> ();
            _eventBroker.AddListener(_listenerMock);
        }
Beispiel #3
0
 public void SetLoadEventReceiver(ILoadEventReceiver loadEventReceiver)
 {
     _loadEventReceiver = loadEventReceiver;
 }