DetachInfoBar() private method

private DetachInfoBar ( IInfoBar currentInfoBar ) : void
currentInfoBar IInfoBar
return void
コード例 #1
0
        public void InfoBarManager_DetachInfoBar()
        {
            // Setup
            Guid windowGuid = new Guid();
            ConfigurableVsWindowFrame frame = this.shell.RegisterToolWindow(windowGuid);
            this.serviceProvider.RegisterService(typeof(SVsInfoBarUIFactory), new ConfigurableVsInfoBarUIFactory());
            var testSubject = new InfoBarManager(this.serviceProvider);
            ConfigurableVsInfoBarHost host = RegisterFrameInfoBarHost(frame);
            IInfoBar infoBarWrapper = testSubject.AttachInfoBar(windowGuid, "Hello", "world", default(ImageMoniker));
            bool closed = false;
            infoBarWrapper.Closed += (s, e) => closed = true;

            // Sanity
            host.AssertInfoBars(1);

            // Act
            testSubject.DetachInfoBar(infoBarWrapper);

            // Verify
            Assert.IsTrue(closed, "Expected to auto-close");
            host.AssertInfoBars(0);
        }
コード例 #2
0
        public void InfoBarManager_DetachInfoBar_ArgChecks()
        {
            // Setup
            var testSubject = new InfoBarManager(this.serviceProvider);

            Exceptions.Expect<ArgumentNullException>(() => testSubject.DetachInfoBar(null));
            Exceptions.Expect<ArgumentException>(() => testSubject.DetachInfoBar(new InvalidInfoBar()));
        }