Example #1
0
 /// <summary>
 /// Called on a background thread by the background thread worker.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     _Presenter.ShutdownApplication();
 }
Example #2
0
        public void ShutdownPresenter_ShutdownApplication_Closes_Plugins()
        {
            var plugin1 = new Mock <IPlugin>();
            var plugin2 = new Mock <IPlugin>();

            plugin1.Setup(p => p.Name).Returns("X");
            plugin2.Setup(p => p.Name).Returns("B");

            plugin1.Setup(p => p.Shutdown()).Callback(() => {
                _View.Verify(v => v.ReportProgress(String.Format(Strings.ShuttingDownPlugin, "X")), Times.Once());
            });

            plugin2.Setup(p => p.Shutdown()).Callback(() => {
                _View.Verify(v => v.ReportProgress(String.Format(Strings.ShuttingDownPlugin, "B")), Times.Once());
            });

            _Plugins.Add(plugin1.Object);
            _Plugins.Add(plugin2.Object);

            _Presenter.Initialise(_View.Object);
            _Presenter.ShutdownApplication();

            plugin1.Verify(p => p.Shutdown(), Times.Once());
            plugin2.Verify(p => p.Shutdown(), Times.Once());
        }