public void RemoveMethodFiresCollectionRemovingEventBeforeRemoving() { Guid id = Guid.NewGuid(); IPipe mockPipe = GetPipe(id); _pipes.Add(id, mockPipe); HelperForCollections helper = new HelperForCollections(); _pipes.Removing += new PipeCollectionEventHandler<IPipes, PipeCollectionEventArgs>(helper.Removing_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { new PipeCollectionEventArgs(PipeCollectionEventArgs.CollectionAction.Remove, mockPipe); recorder.CheckArguments(); helper.Removing_DummyHandler(null, null); } bool result = _pipes.Remove(mockPipe); MockManager.Verify(); Assert.True(result); }
public void RemoveMethodWithListOfPipesAsParamFiresCollectionRemovingEventBeforeRemoving() { Guid id = Guid.NewGuid(); IPipe pipe = _dummyFactory.CreateDummyNetworkPipe(id); Guid[] ids = { id }; _pipes.Add(id, pipe); IList<IPipe> elementsToBeRemoved = new List<IPipe>(); elementsToBeRemoved.Add(pipe); bool[] removealResults = { true }; IPipe[] elementsRemovedArray = { pipe }; HelperForCollections helper = new HelperForCollections(); _pipes.Removing += new PipeCollectionEventHandler<IPipes, PipeCollectionEventArgs>(helper.Removing_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { helper.Removing_DummyHandler(null, null); } bool[] results = _pipes.Remove(elementsToBeRemoved); MockManager.Verify(); Assert.NotNull(results); Assert.True(results[0]); }
public void RemoveMethodByArrayOfKeysFiresCollectionRemovingEventBeforeRemoving() { Guid id = Guid.NewGuid(); IPipe pipe = _dummyFactory.CreateDummyNetworkPipe(id); Guid[] ids = { id }; IPipe[] elsRemoved = { pipe }; _pipes.Add(id, pipe); HelperForCollections helper = new HelperForCollections(); _pipes.Removing += new PipeCollectionEventHandler<IPipes, PipeCollectionEventArgs>(helper.Removing_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { new PipeCollectionEventArgs(PipeCollectionEventArgs.CollectionAction.Remove, elsRemoved); recorder.CheckArguments(); helper.Removing_DummyHandler(null, null); } bool[] results = _pipes.Remove(ids); MockManager.Verify(); Assert.NotNull(results); Assert.True(results[0]); }
public void RemoveMethodFiresCollectionRemovingEventBeforeRemoving() { Guid id = Guid.NewGuid(); IElement el = _dummyFactory.CreateDummyEl(id); _elements.Add(id, el); HelperForCollections helper = new HelperForCollections(); _elements.Removing += new ElementCollectionEventHandler<IElements, ElementCollectionEventArgs>(helper.Removing_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { helper.Removing_DummyHandler(null, null); } bool result = _elements.Remove(el); MockManager.Verify(); Assert.True(result); }
public void RemoveMethodWithListOfCommentsAsParamFiresCollectionRemovingEventBeforeRemoving() { Guid id = Guid.NewGuid(); IUtility el = _dummyFactory.CreateDummyComment(id); Guid [] ids = {id}; _comments.Add(id, el); IList<IUtility> commentsToBeRemoved = new List<IUtility>(); commentsToBeRemoved.Add(el); bool [] removealResults = {true}; IUtility[] commentsRemovedArray = {el}; HelperForCollections helper = new HelperForCollections(); _comments.Removing += new UtilityCollectionEventHandler<IUtilitiesMgr, UtilityCollectionEventArgs>(helper.Removing_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { helper.Removing_DummyHandler(null, null); } bool [] results = _comments.Remove(commentsToBeRemoved); MockManager.Verify(); Assert.NotNull(results); Assert.True(results[0]); }
public void RemoveMethodByKeyValuePairFiresCollectionRemovingEventBeforeRemoving() { Guid id = Guid.NewGuid(); IUtility el = _dummyFactory.CreateDummyComment(id); KeyValuePair<Guid, IUtility> kvp = new KeyValuePair<Guid, IUtility>(id, el); _comments.Add(id, el); HelperForCollections helper = new HelperForCollections(); _comments.Removing += new UtilityCollectionEventHandler<IUtilitiesMgr, UtilityCollectionEventArgs>(helper.Removing_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { helper.Removing_DummyHandler(null, null); } bool result = _comments.Remove(kvp); MockManager.Verify(); Assert.True(result); }
public void RemoveMethodByArrayOfKeysFiresCollectionRemovingEventBeforeRemoving() { Guid id = Guid.NewGuid(); IUtility el = _dummyFactory.CreateDummyComment(id); Guid [] ids = {id}; IUtility [] elsRemoved = {el}; _comments.Add(id, el); HelperForCollections helper = new HelperForCollections(); _comments.Removing += new UtilityCollectionEventHandler<IUtilitiesMgr, UtilityCollectionEventArgs>(helper.Removing_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { new UtilityCollectionEventArgs(UtilityCollectionEventArgs.CollectionAction.Remove, elsRemoved); recorder.CheckArguments(); helper.Removing_DummyHandler(null, null); } bool [] results = _comments.Remove(ids); MockManager.Verify(); Assert.NotNull(results); Assert.True(results[0]); }