Exemple #1
0
        public void Debug_Fail_does_not_throw_when_no_callback_has_been_registered()
        {
            //Arrange

            //Act
            DebugCore.Fail("message");

            //Assert
            Assert.Pass();
        }
Exemple #2
0
        public void Debug_Assert_false_does_not_throw_when_ignore_callback_has_been_registered()
        {
            //Arrange
            DebugCore.SetAssertionFailedCallback((res) => AssertionResponse.Ignore);

            //Act
            DebugCore.Assert(false, "message");

            //Assert
            Assert.Pass();
        }
Exemple #3
0
        public void Debug_Assert_true_does_not_calls_registered_callback()
        {
            //Arrange
            var count = 0;

            DebugCore.SetAssertionFailedCallback((res) =>
            {
                Interlocked.Increment(ref count);
                return(AssertionResponse.Ignore);
            });

            //Act
            DebugCore.Assert(true, "message");

            //Assert
            Assert.AreEqual(0, count);
        }
Exemple #4
0
        public void Debug_Fail_provide_expected_SourceMethod()
        {
            //Arrange
            var count = 0;

            DebugCore.SetAssertionFailedCallback((res) =>
            {
                Interlocked.Increment(ref count);
                Assert.AreEqual(nameof(Debug_Fail_provide_expected_SourceMethod), res.SourceMethod);
                return(AssertionResponse.Ignore);
            });

            //Act
            DebugCore.Fail("message");

            //Assert
            Assert.AreEqual(1, count);
        }
Exemple #5
0
        public void Debug_Fail_provide_expected_stackTrace()
        {
            //Arrange
            var count = 0;

            DebugCore.SetAssertionFailedCallback((res) =>
            {
                Interlocked.Increment(ref count);
                Assert.IsNotEmpty(res.StackTrace);
                return(AssertionResponse.Ignore);
            });

            //Act
            DebugCore.Fail("message");

            //Assert
            Assert.AreEqual(1, count);
        }
Exemple #6
0
        /// <summary>
        /// Perform closing commands (Make sure all settings are saved)
        /// </summary>
        private void PerformClosingCommands()
        {
            //Unload all registered plugins incase none managable objects were used in plugins
            PluginHolder.Instance.UnloadAllRegisteredPlugins();

            SaveAllDocuments();

            Properties.Settings.Default.OpenedFiles.Clear();
            foreach (var document in DocumentPane.Children)
            {
                var child = ((TextEditor.TextEditor)document.Content);

                if (child.OpenedDocument != null)
                {
                    Properties.Settings.Default.OpenedFiles.Add(child.OpenedDocument);
                }
            }

            UpdatePanes();
            //Write layout
            XmlWriter xmlWriter = XmlWriter.Create("layout.xml");

            xmlWriter.WriteStartDocument();
            xmlWriter.WriteStartElement("panes");

            foreach (var pane in dictionaryOfPanes)
            {
                xmlWriter.WriteStartElement("pane");
                xmlWriter.WriteAttributeString("title", pane.Key);
                xmlWriter.WriteAttributeString("paneLocation", pane.Value._paneLocation.ToString());
                xmlWriter.WriteAttributeString("width", pane.Value._width.ToString());
                xmlWriter.WriteAttributeString("height", pane.Value._height.ToString());
                xmlWriter.WriteAttributeString("isCollapsed", pane.Value._isAutoHide.ToString());
                xmlWriter.WriteEndElement();
            }

            xmlWriter.WriteEndElement();
            xmlWriter.WriteEndDocument();
            xmlWriter.Close();

            Properties.Settings.Default.Save();

            DebugCore.CloseProcess();
        }