Пример #1
0
        private void VerifyDecoyStatus(int expectedDecoys, int expectedNoSource, int expectedWrongTransitionCount)
        {
            PeptideGroupDocNode decoyGroup = null;

            RunUI(() => decoyGroup = SkylineWindow.DocumentUI.PeptideGroups.FirstOrDefault(group => group.IsDecoy));
            Assert.IsNotNull(decoyGroup);
            int numNoSource = 0, numWrongTransitionCount = 0;

            RunUI(() => decoyGroup.CheckDecoys(SkylineWindow.DocumentUI, out numNoSource, out numWrongTransitionCount, out _));
            Assert.AreEqual(expectedDecoys, decoyGroup.PeptideCount);
            Assert.AreEqual(expectedNoSource, numNoSource);
            Assert.AreEqual(expectedWrongTransitionCount, numWrongTransitionCount);

            if (numNoSource > 0 || numWrongTransitionCount > 0)
            {
                RunDlg <MultiButtonMsgDlg>(SkylineWindow.ImportResults, dlg =>
                {
                    Assert.IsTrue(
                        dlg.Message.StartsWith(string.Format(
                                                   Resources.SkylineWindow_ImportResults_The_document_contains_decoys_that_do_not_match_the_targets__Out_of__0__decoys_, decoyGroup.PeptideCount)));
                    if (numNoSource == 1)
                    {
                        Assert.IsTrue(dlg.Message.Contains(Resources.SkylineWindow_ImportResults_1_decoy_does_not_have_a_matching_target));
                    }
                    else if (numNoSource > 1)
                    {
                        Assert.IsTrue(dlg.Message.Contains(string.Format(
                                                               Resources.SkylineWindow_ImportResults__0__decoys_do_not_have_a_matching_target, numNoSource)));
                    }
                    if (numWrongTransitionCount == 1)
                    {
                        Assert.IsTrue(dlg.Message.Contains(Resources.SkylineWindow_ImportResults_1_decoy_does_not_have_the_same_number_of_transitions_as_its_matching_target));
                    }
                    else if (numWrongTransitionCount > 1)
                    {
                        Assert.IsTrue(dlg.Message.Contains(string.Format(
                                                               Resources.SkylineWindow_ImportResults__0__decoys_do_not_have_the_same_number_of_transitions_as_their_matching_targets, numWrongTransitionCount)));
                    }
                    dlg.BtnCancelClick();
                });
            }
        }