コード例 #1
0
        public void When_install_of_a_prerequisite_fails_remote_the_state_shall_move_into_error_status()
        {
            TestPrerequisite[] TestPrerequisites = { new TestPrerequisite("Name1", true, false, null) };
            AdminProcess       AdminProcess      = new AdminProcess();
            InstallWindowModel Model             = new InstallWindowModel(TestPrerequisites, (downloadId, progressCallback, downloadedCallback) => this.DownloadFunc(downloadId, progressCallback, downloadedCallback, TestPrerequisites.First(_ => _.DownloadId == downloadId)), AdminProcess);

            Assert.That(Model.Status, Is.TypeOf <InstallWindowModel.PreperationStatus>());
            ((InstallWindowModel.PreperationStatus)Model.Status).SetUpSystemCommand.Execute(null);

            InstallWindowModelTest.WaitForStateChange <InstallWindowModel.InstallationStatus>(Model);

            AdminProcess.MarkInstalled(false);

            InstallWindowModelTest.WaitForStateChange <InstallWindowModel.InstallationErrorStatus>(Model);
            Assert.That(((InstallWindowModel.InstallationErrorStatus)Model.Status).Message, Is.EqualTo("FAIL!"));
        }
コード例 #2
0
        public void When_administrative_rights_are_needded_those_prerequisites_shall_be_delegated_to_child_process_with_admin_rights()
        {
            TestPrerequisite[] TestPrerequisites = { new TestPrerequisite("Name1", true, false, null), new TestPrerequisite("Name2", false, false, null) };
            AdminProcess       AdminProcess      = new AdminProcess();
            InstallWindowModel Model             = new InstallWindowModel(TestPrerequisites, (downloadId, progressCallback, downloadedCallback) => this.DownloadFunc(downloadId, progressCallback, downloadedCallback, TestPrerequisites.First(_ => _.DownloadId == downloadId)), AdminProcess);

            Assert.That(Model.Status, Is.TypeOf <InstallWindowModel.PreperationStatus>());
            Assert.That(((InstallWindowModel.PreperationStatus)Model.Status).IsAdminRequired, Is.True);
            ((InstallWindowModel.PreperationStatus)Model.Status).SetUpSystemCommand.Execute(null);
            InstallWindowModelTest.WaitForStateChange <InstallWindowModel.InstallationStatus>(Model);

            AdminProcess.WaitInstallStarted();
            AdminProcess.MarkInstalled(true);

            TestPrerequisites[1].MarkInstalled(true);

            InstallWindowModelTest.WaitForStateChange <InstallWindowModel.InstallationSuccessStatus>(Model);
        }