SaveState() public method

public SaveState ( ) : void
return void
Esempio n. 1
0
        public void Visibility() {
            var settings = Substitute.For<IRToolsSettings>();
            // NSub does not work with dynamic, see "https://github.com/nsubstitute/NSubstitute/issues/143"
            var dte = new DteMock();
            var cbs = Substitute.For<CommandBars.CommandBars>();
            dte.CommandBars = cbs;

            var cb = Substitute.For<CommandBar>();
            cbs["R Toolbar"].Returns(cb);
            var tb = new RToolbar(dte, settings);
            tb.Show();
            cb.Visible.Should().BeFalse();

            settings.ShowRToolbar.Returns(true);
            tb.Show();
            cb.Visible.Should().BeTrue();

            tb.SaveState();
            settings.ShowRToolbar.Should().BeTrue();

            cb.Visible = false;
            tb.SaveState();
            settings.ShowRToolbar.Should().BeFalse();
        }
Esempio n. 2
0
 protected override int QueryClose(out bool canClose)
 {
     _toolbar.SaveState();
     return(base.QueryClose(out canClose));
 }