private void scenario(int[] nodes, int expectedMatches, int expectedMoleculeFilteredCount, UniquePeptidesDlg.UniquenessType testType, bool bogus = false) { var rowcount = 0; RunUI(() => { var node = SkylineWindow.SequenceTree.Nodes[nodes[0]]; SkylineWindow.SequenceTree.SelectedNode = node; // Clears any existing selection foreach (var i in nodes) { node = SkylineWindow.SequenceTree.Nodes[i]; SkylineWindow.SequenceTree.SelectNode((TreeNodeMS)node, true); rowcount += node.GetNodeCount(false); } }); var upgradeBackgroundProteome = ShowDialog <AlertDlg>(SkylineWindow.ShowUniquePeptidesDlg); var uniquePeptidesDlg = ShowDialog <UniquePeptidesDlg>(upgradeBackgroundProteome.ClickNo); WaitForConditionUI(() => uniquePeptidesDlg.GetDataGridView().RowCount == rowcount); if (bogus) { uniquePeptidesDlg.BeginInvoke(new Action(() => uniquePeptidesDlg.SelectUnique(testType))); // Expect a warning about missing metadata var errorDlg = WaitForOpenForm <MessageDlg>(); var expectedErr = testType == UniquePeptidesDlg.UniquenessType.gene ? Resources.UniquePeptidesDlg_SelectPeptidesWithNumberOfMatchesAtOrBelowThreshold_Some_background_proteome_proteins_did_not_have_gene_information__this_selection_may_be_suspect_ : Resources.UniquePeptidesDlg_SelectPeptidesWithNumberOfMatchesAtOrBelowThreshold_Some_background_proteome_proteins_did_not_have_species_information__this_selection_may_be_suspect_; Assert.IsTrue(errorDlg.Message.Contains(expectedErr)); RunUI(() => errorDlg.OkDialog()); } else { RunUI(() => { Assert.AreEqual(2 + expectedMatches, uniquePeptidesDlg.GetDataGridView().ColumnCount); if (testType == EXCLUDE_BACKGROUND) { uniquePeptidesDlg.ExcludeBackgroundProteome(); } else { uniquePeptidesDlg.SelectUnique(testType); } }); } var doc = SkylineWindow.Document; OkDialog(uniquePeptidesDlg, uniquePeptidesDlg.OkDialog); if (expectedMoleculeFilteredCount > 0) { doc = WaitForDocumentChange(doc); } AssertEx.IsDocumentState(doc, null, 25, INITIAL_MOLECULE_COUNT - expectedMoleculeFilteredCount, null, null); }
private void scenario(int nodeNum, int expectedMatches, int expectedMoleculeFilteredCount, UniquePeptidesDlg.UniquenessType testType, bool bogus = false) { scenario(new [] { nodeNum }, expectedMatches, expectedMoleculeFilteredCount, testType, bogus); }