Пример #1
0
        public async Task Test01_SequencerPreRunSetupTest()
        {
            AutomationSequencer sequencer = new AutomationSequencer()
            {
                AutomationRunnerSettings = this.AutomationRunnerSettings,
                CancellationToken        = nullToken,
                DatabaseAutomationRunner = null,
                DatabaseManager          = null
            };

            Assert.IsTrue(await sequencer.LoadBranchesListAsync());
            Assert.IsTrue(await sequencer.LoadRootDocumentAsync());
            Assert.IsTrue(sequencer.ParseRootDocumentAsync());
        }
        private async Task LoadAutomationSequencerAsync()
        {
            if (!AutomationSettings.UseLocalRunnerDatabase)
            {
                //load branches from the server
                Logging.Info("Loading branches");
                await AutomationSequencer.LoadBranchesListAsync();

                //ensure that the branch specified in settings exists, and if so apply it. else apply the default setting
                if (!AutomationSequencer.AutomationBranches.Contains(AutomationSettings.SelectedBranch))
                {
                    Logging.Error("The selected branch does not exist on the server: {0}", AutomationSettings.SelectedBranch);
                    MessageBox.Show(string.Format("The selected branch {0} does not exist on the server, setting to default", AutomationSettings.SelectedBranch));
                    AutomationSettings.SelectedBranch             = AutomationSequencer.AutomationRepoDefaultBranch;
                    AutomamtionDatabaseSelectedBranchSetting.Text = AutomationSequencer.AutomationRepoDefaultBranch;
                    //TODO: command line mode should be an exit return
                }
                else
                {
                    Logging.Info("Applying branch to load from: {0}", AutomationSettings.SelectedBranch);
                }
            }

            //load the available package sequences from the root document
            SequencesAvailableListBox.Items.Clear();
            SequencesToRunListBox.Items.Clear();
            SequencesAvailableListBox.Items.Add("Loading available sequences from database...");
            Logging.Info("Loading sequences from root document");
            await AutomationSequencer.LoadRootDocumentAsync();

            //parse the document now that it's loaded
            Logging.Info("Parsing sequences from root document");
            AutomationSequencer.ParseRootDocumentAsync();

            //load the sequences into the listbox view
            SequencesAvailableListBox.Items.Clear();
            foreach (AutomationSequence sequence in AutomationSequencer.AutomationSequences)
            {
                SequencesAvailableListBox.Items.Add(sequence);
            }
        }