public void ClearMethodFiresCollectionClearedEventBeforeRemoving() { Guid id = Guid.NewGuid(); IPipe mockPipe = GetPipe(id); _pipes.Add(id, mockPipe); int clearCount = _pipes.Count; HelperForCollections helper = new HelperForCollections(); _pipes.Cleared += new ClearEventHandler<IPipes, ClearEventArgs>(helper.Cleared_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { new ClearEventArgs(clearCount); recorder.CheckArguments(); helper.Cleared_DummyHandler(null, null); } _pipes.Clear(); MockManager.Verify(); Assert.Equal(0, _pipes.Count); }
public void ClearMethodFiresCollectionClearedEventBeforeRemoving() { Guid id = Guid.NewGuid(); IElement el = _dummyFactory.CreateDummyEl(id); _elements.Add(id, el); int clearCount = _elements.Count; HelperForCollections helper = new HelperForCollections(); _elements.Cleared += new ClearEventHandler<IElements, ClearEventArgs>(helper.Cleared_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { new ClearEventArgs(clearCount); recorder.CheckArguments(); helper.Cleared_DummyHandler(null, null); } _elements.Clear(); MockManager.Verify(); Assert.Equal(0, _elements.Count); }