Exemplo n.º 1
0
        public void SetterIndexerFiresCollectionModifyiedEventAfterModifying()
        {
            Guid id = Guid.NewGuid();
            IPipe pipe = GetPipe(id);
            IPipe mockPipe = new Mock<IPipe>(); // assume it is a modified version of 'pipe'

            _pipes.Add(id, pipe);

            HelperForCollections helper = new HelperForCollections();
            _pipes.Modified += new PipeCollectionEventHandler<IPipes, PipeCollectionEventArgs>(helper.Modified_DummyHandler);
            using (RecordExpectations recorder = RecorderManager.StartRecording())
            {
                new PipeCollectionEventArgs(PipeCollectionEventArgs.CollectionAction.Modify, pipe);
                recorder.CheckArguments();
                helper.Modified_DummyHandler(null, null);
            }

            _pipes[id] = mockPipe;
            MockManager.Verify();
        }
Exemplo n.º 2
0
        public void SetterIndexerFiresCollectionModifyiedEventAfterModifying()
        {
            Guid id = Guid.NewGuid();
            IElement el = _dummyFactory.CreateDummyEl(id);
            IElement mockEl = new Mock<IElement>(); // assume it is a modified version of 'el'

            _elements.Add(id, el);

            HelperForCollections helper = new HelperForCollections();
            _elements.Modified += new ElementCollectionEventHandler<IElements, ElementCollectionEventArgs>(helper.Modified_DummyHandler);
            using (RecordExpectations recorder = RecorderManager.StartRecording())
            {
                new ElementCollectionEventArgs(ElementCollectionEventArgs.CollectionAction.Modify, el);
                recorder.CheckArguments();
                helper.Modified_DummyHandler(null, null);
            }

            _elements[id] = mockEl;
            MockManager.Verify();
        }