Exemple #1
0
        public void DisposingFolderDisposesContents()
        {
            Folder    folder   = new Folder();
            IDataItem dataItem = mocks.StrictMultiMock <IDataItem>(new[] { typeof(IDisposable) });

            (dataItem as IDisposable).Expect(d => d.Dispose()).Repeat.Once(); //our test
            dataItem.Expect(d => d.LinkedBy).Return(new List <IDataItem>()).Repeat.Any();
            dataItem.Expect(d => d.Owner).Repeat.Any().SetPropertyAndIgnoreArgument();

            mocks.ReplayAll();

            folder.Items.Add(dataItem);
            folder.Dispose();

            mocks.VerifyAll();
        }