Exemplo n.º 1
0
        /// <summary>
        /// Tests that we fail gracefully when document settings would result in an excessive number of nodes.
        /// </summary>
        protected override void DoTest()
        {
            // User managed to create an interesting incomplete file that can only be opened with proper local paths
            string text = File.ReadAllText(TestFilesDir.GetTestPath("wildsettings.sky"));

            text = text.Replace(@"__TESTPATH__", TestFilesDir.FullPath);
            File.WriteAllText(TestFilesDir.GetTestPath("wildsettings.sky"), text);

            int maxTransDefault = SrmDocument.MaxTransitionCount;

            SrmDocument.SetTestMaxTransitonCount(SrmDocument.MaxTransitionCount / 8);
            try
            {
                // Open the file and it should fail quickly
                RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("wildsettings.sky")));
                // Should present an error dialog
                var errorDlg = WaitForOpenForm <MessageDlg>();
                RunUI(() =>
                {
                    Assert.IsTrue(errorDlg.Message.Contains(String.Format(
                                                                Resources.PeptideGroupDocNode_ChangeSettings_The_current_document_settings_would_cause_the_number_of_targeted_transitions_to_exceed__0_n0___The_document_settings_must_be_more_restrictive_or_add_fewer_proteins_,
                                                                SrmDocument.MaxTransitionCount)));
                    errorDlg.OkDialog();
                });
            }
            finally
            {
                SrmDocument.SetTestMaxTransitonCount(maxTransDefault);
            }
        }