Example #1
0
        public void InstallFailTest()
        {
            InstallerConfiguration config = new InstallerConfiguration();
            MockFailingAction action = new MockFailingAction();
            config.AddAction(action);
            Installer installer = new Installer("", manifest, config);

            ManualResetEvent manualEvent = new ManualResetEvent(false);
            InstallerFailedEventArgs raisedEventArgs = null;
            installer.Failed += delegate(object sender, InstallerFailedEventArgs e)
            {
                raisedEventArgs = e;
                manualEvent.Set();
            };
            installer.Install();
            manualEvent.WaitOne(1000, false);

            Assert.IsNotNull(raisedEventArgs, "Failed event should be fired.");
            Assert.AreEqual(action.Exception, raisedEventArgs.Exception, "Exception should be set.");
        }
Example #2
0
        public void InstallTest()
        {
            InstallerConfiguration config = new InstallerConfiguration();
            MockInstallerAction action = new MockInstallerAction();
            config.AddAction(action);

            Installer installer = new Installer("", manifest, config);

            Assert.IsFalse(action.ActionInstalled);

            Boolean installerCompleted = false;
            ManualResetEvent manualEvent = new ManualResetEvent(false);
            installer.Completed += delegate(object sender, EventArgs e)
            {
                installerCompleted = true;
                manualEvent.Set();
            };
            installer.Install();
            manualEvent.WaitOne(1000, false);

            Assert.IsTrue(installerCompleted, "Installer completed.");
            Assert.IsTrue(action.ActionInstalled, "Action installed.");
        }
Example #3
0
        public void ProgressTest()
        {
            InstallerConfiguration config = new InstallerConfiguration();
            config.AddAction(new MockInstallerAction());
            config.AddAction(new MockInstallerAction());
            config.AddAction(new MockInstallerAction());

            Installer installer = new Installer("", manifest, config);

            Int32 prevProgress = 0;
            ManualResetEvent manualEvent = new ManualResetEvent(false);
            installer.Progress += delegate(object sender, InstallerProgressEventArgs e)
            {
                Assert.IsTrue(e.Progress > prevProgress);
                prevProgress = e.Progress;
            };
            installer.Completed += delegate(object sender, EventArgs e)
            {
                manualEvent.Set();
            };
            installer.Install();
            manualEvent.WaitOne(1000, false);

            Assert.AreEqual(100, prevProgress, "Installer progress.");
        }
Example #4
0
 public override bool Undo(Installer installer)
 {
     throw Exception;
 }