public void ShouldDisposeAsManyAsPossibleWhenExeptionsAreThrown()
        {
            var obj1 = new DisposableObject();
            var obj2 = new DisposableObjectThatThrowsOnDispose();

            var obj3 = new DisposableObject();
            var obj4 = new DisposableObjectThatThrowsOnDispose();

            try
            {
                using (var container = new UnityContainer())
                {
                    container.RegisterInstance(nameof(obj1), obj1);
                    container.RegisterInstance(nameof(obj2), obj2);
                    container.RegisterInstance(nameof(obj3), obj3);
                    container.RegisterInstance(nameof(obj4), obj4);
                }

                Assert.Fail("Exceptions should be thrown");
            }
            catch (AggregateException e)
            {
                Assert.AreEqual(2, e.InnerExceptions.Count);
            }

            Assert.IsTrue(obj1.WasDisposed);
            Assert.IsTrue(obj2.WasDisposed);
            Assert.IsTrue(obj3.WasDisposed);
            Assert.IsTrue(obj4.WasDisposed);
        }
        public void ShouldDisposeAsManyAsPossibleWhenSingleExeptionIsThrown()
        {
            var obj1 = new DisposableObject();
            var obj2 = new DisposableObjectThatThrowsOnDispose();

            var obj3 = new DisposableObject();

            try
            {
                using (var container = new UnityContainer())
                {
                    container.RegisterInstance(nameof(obj1), obj1);
                    container.RegisterInstance(nameof(obj2), obj2);
                    container.RegisterInstance(nameof(obj3), obj3);
                }

                Assert.Fail("Exceptions should be thrown");
            }
            catch (NotImplementedException)
            {
            }

            Assert.IsTrue(obj1.WasDisposed);
            Assert.IsTrue(obj2.WasDisposed);
            Assert.IsTrue(obj3.WasDisposed);
        }