public void PartAdded()
        {
            // Arrange
            var features = new TestFeatureCollection();

            features.AddMock <IPackageEventsFeature>();
            features.AddMock <IPartEventsFeature>();

            var feature = Substitute.For <IDisposable>();

            features.AddDisposableFeature();
            features.SetDisposable(feature);

            var part = Substitute.ForPartsOf <OpenXmlPart>();

            part.Configure().Features.Returns(new TestFeatureCollection());

            // Act
            features.GetRequired <IPartEventsFeature>().Change += Raise.Event <Action <FeatureEventArgs <OpenXmlPart> > >(new FeatureEventArgs <OpenXmlPart>(EventType.Created, part));

            // Assert
            Assert.NotNull(part.Features.Get <IDisposableFeature>());
        }
        public void PackageLevelDisposables()
        {
            // Arrange
            var features = new TestFeatureCollection();

            features.AddMock <IPackageEventsFeature>();
            features.AddMock <IPartEventsFeature>();

            var feature = Substitute.For <IDisposable>();

            features.AddDisposableFeature();
            features.SetDisposable(feature);

            var package = Substitute.ForPartsOf <OpenXmlPackage>();

            package.Configure().Features.Returns(features);

            // Act
            features.GetRequired <IPackageEventsFeature>().Change += Raise.Event <Action <FeatureEventArgs <OpenXmlPackage> > >(new FeatureEventArgs <OpenXmlPackage>(EventType.Closed, package));

            // Assert
            feature.Received(1).Dispose();
        }