public async Task ContentChangedNotification()
        {
            var attr1 = new ExportDocumentControllerExtensionAttribute {
                FileExtension = ".test"
            };
            var attr2 = new ExportDocumentControllerExtensionAttribute {
                FileExtension = ".test"
            };

            try {
                IdeServices.DocumentControllerService.RegisterControllerExtension(attr1, typeof(TestExtension <Test1>));
                IdeServices.DocumentControllerService.RegisterControllerExtension(attr2, typeof(TestExtension <Test2>));

                using (var controller = new TestControllerWithExtension()) {
                    await controller.Initialize(new FileDescriptor ("foo.test", null, null));

                    TestExtension <Test1> .ResetCounters();

                    TestExtension <Test2> .ResetCounters();

                    controller.NotifyContentChanged();

                    Assert.AreEqual(1, TestExtension <Test1> .ContentChangedCount);
                    Assert.AreEqual(1, TestExtension <Test2> .ContentChangedCount);
                }
            } finally {
                IdeServices.DocumentControllerService.UnregisterControllerExtension(attr1);
                IdeServices.DocumentControllerService.UnregisterControllerExtension(attr2);
            }
        }
        public async Task KeepExtensionInstanceOnRefresh()
        {
            // When reloading extensions, if an extension still applies it should be reused, not re-created

            var attr1 = new ExportDocumentControllerExtensionAttribute {
                FileExtension = ".test1, .test2"
            };
            var attr2 = new ExportDocumentControllerExtensionAttribute {
                FileExtension = ".test1"
            };
            var attr3 = new ExportDocumentControllerExtensionAttribute {
                FileExtension = ".test2"
            };

            try {
                TestExtension <Test1> .ResetCounters();

                TestExtension <Test2> .ResetCounters();

                TestExtension <Test3> .ResetCounters();

                IdeServices.DocumentControllerService.RegisterControllerExtension(attr1, typeof(TestExtension <Test1>));
                IdeServices.DocumentControllerService.RegisterControllerExtension(attr2, typeof(TestExtension <Test2>));
                IdeServices.DocumentControllerService.RegisterControllerExtension(attr3, typeof(TestExtension <Test3>));

                using (var controller = new TestControllerWithExtension()) {
                    await controller.Initialize(new FileDescriptor ("foo.test1", null, null));

                    var instance = controller.GetContent <TestExtension <Test1> > ();
                    Assert.IsNotNull(instance);
                    Assert.AreEqual(1, TestExtension <Test1> .LiveExtensions.Count());

                    Assert.IsNotNull(controller.GetContent <TestExtension <Test2> > ());
                    Assert.AreEqual(1, TestExtension <Test2> .LiveExtensions.Count());

                    Assert.IsNull(controller.GetContent <TestExtension <Test3> > ());
                    Assert.AreEqual(0, TestExtension <Test3> .LiveExtensions.Count());

                    controller.FilePath = "foo.test2";

                    Assert.AreSame(instance, controller.GetContent <TestExtension <Test1> > ());
                    Assert.AreEqual(1, TestExtension <Test1> .LiveExtensions.Count());

                    Assert.IsNull(controller.GetContent <TestExtension <Test2> > ());
                    Assert.AreEqual(0, TestExtension <Test2> .LiveExtensions.Count());

                    Assert.IsNotNull(controller.GetContent <TestExtension <Test3> > ());
                    Assert.AreEqual(1, TestExtension <Test3> .LiveExtensions.Count());

                    controller.FilePath = "foo.test1";

                    Assert.AreSame(instance, controller.GetContent <TestExtension <Test1> > ());
                    Assert.AreEqual(1, TestExtension <Test1> .LiveExtensions.Count());

                    Assert.IsNotNull(controller.GetContent <TestExtension <Test2> > ());
                    Assert.AreEqual(1, TestExtension <Test2> .LiveExtensions.Count());

                    Assert.IsNull(controller.GetContent <TestExtension <Test3> > ());
                    Assert.AreEqual(0, TestExtension <Test3> .LiveExtensions.Count());
                }
            } finally {
                IdeServices.DocumentControllerService.UnregisterControllerExtension(attr1);
                IdeServices.DocumentControllerService.UnregisterControllerExtension(attr2);
                IdeServices.DocumentControllerService.UnregisterControllerExtension(attr3);
            }
        }