public void SetDataFromSubTransaction()
        {
            var counter = new OrderedExpectationCounter();

            _collectionEndPointMock.Stub(stub => stub.GetCollectionEventRaiser()).Return(_eventRaiserMock);

            var sourceDataManager = MockRepository.GenerateStub <ICollectionEndPointDataManager> ();
            var sourceLoadState   = new CompleteCollectionEndPointLoadState(sourceDataManager, _endPointProviderStub, _transactionEventSinkStub);

            _dataManagerMock.Expect(mock => mock.SetDataFromSubTransaction(sourceDataManager, _endPointProviderStub)).Ordered(counter);
            _dataManagerMock.Replay();

            _eventRaiserMock.Expect(mock => mock.WithinReplaceData()).Ordered(counter);
            _eventRaiserMock.Replay();

            _loadState.SetDataFromSubTransaction(_collectionEndPointMock, sourceLoadState);

            _dataManagerMock.VerifyAllExpectations();
            _eventRaiserMock.VerifyAllExpectations();
        }
Exemplo n.º 2
0
        public void Clear()
        {
            using (_mockRepository.Ordered())
            {
                _eventRaiserMock.Expect(mock => mock.BeginRemove(0, _order1)).WhenCalled(mi => Assert.That(_eventRaisingDecoratorWithRealContent.Count, Is.EqualTo(3)));
                _eventRaiserMock.Expect(mock => mock.BeginRemove(1, _order3)).WhenCalled(mi => Assert.That(_eventRaisingDecoratorWithRealContent.Count, Is.EqualTo(3)));
                _eventRaiserMock.Expect(mock => mock.BeginRemove(2, _order4)).WhenCalled(mi => Assert.That(_eventRaisingDecoratorWithRealContent.Count, Is.EqualTo(3)));

                _eventRaiserMock.Expect(mock => mock.EndRemove(2, _order4)).WhenCalled(mi => Assert.That(_eventRaisingDecoratorWithRealContent.Count, Is.EqualTo(0)));
                _eventRaiserMock.Expect(mock => mock.EndRemove(1, _order3)).WhenCalled(mi => Assert.That(_eventRaisingDecoratorWithRealContent.Count, Is.EqualTo(0)));
                _eventRaiserMock.Expect(mock => mock.EndRemove(0, _order1)).WhenCalled(mi => Assert.That(_eventRaisingDecoratorWithRealContent.Count, Is.EqualTo(0)));
            }

            _eventRaiserMock.Replay();

            _eventRaisingDecoratorWithRealContent.Clear();

            _eventRaiserMock.VerifyAllExpectations();
        }
Exemplo n.º 3
0
        public override void SetUp()
        {
            base.SetUp();

            _mockRepository  = new MockRepository();
            _eventRaiserMock = _mockRepository.StrictMock <IDomainObjectCollectionEventRaiser> ();

            _order1 = DomainObjectIDs.Order1.GetObject <Order> ();
            _order3 = DomainObjectIDs.Order3.GetObject <Order> ();
            _order4 = DomainObjectIDs.Order4.GetObject <Order> ();
            _order5 = DomainObjectIDs.Order5.GetObject <Order> ();

            var realContent = new DomainObjectCollectionData(new[] { _order1, _order3, _order4 });

            _eventRaisingDecoratorWithRealContent = new EventRaisingCollectionDataDecorator(_eventRaiserMock, realContent);

            _eventRaiserMock.BackToRecord();
            _eventRaiserMock.Replay();
        }