public void OnSessionDisposed_InvokeWithSessionDisposed_CallsHandler(EventArgs eventArgs)
        {
            var          manager   = new SubDesignerSerializationManager();
            int          callCount = 0;
            EventHandler handler   = (sender, e) =>
            {
                Assert.Same(manager, sender);
                Assert.Same(eventArgs, e);
                callCount++;
            };

            manager.SessionDisposed += handler;

            manager.OnSessionDisposed(eventArgs);
            Assert.Equal(1, callCount);

            // Call again.
            manager.OnSessionDisposed(eventArgs);
            Assert.Equal(2, callCount);

            // Remove handler.
            manager.SessionDisposed -= handler;
            manager.OnSessionDisposed(eventArgs);
            Assert.Equal(2, callCount);
        }
        public void DesignerSerializationManager_OnSessionDisposed_InvokeWithSerializationComplete_CallsHandler(EventArgs eventArgs)
        {
            var          manager   = new SubDesignerSerializationManager();
            int          callCount = 0;
            EventHandler handler   = (sender, e) =>
            {
                Assert.Same(manager, sender);
                Assert.Same(eventArgs, e);
                callCount++;
            };
            IDisposable session = manager.CreateSession();

            manager.SerializationComplete += handler;
            manager.OnSessionDisposed(eventArgs);
            Assert.Equal(1, callCount);
            session.Dispose();

            // Call again.
            session = manager.CreateSession();
            session.Dispose();
            Assert.Equal(1, callCount);

            // Remove handler.
            session = manager.CreateSession();
            manager.SerializationComplete += handler;
            manager.SerializationComplete -= handler;
            session.Dispose();
            Assert.Equal(1, callCount);
        }