private void GenerateCallbacks(object sender, RoutedEventArgs e)
        {
            // First, check whether any text is selected
            try
            {
                var customUi = new XmlDocument();
                customUi.LoadXml(this.Editor.Text);

                var callbacks = CallbacksBuilder.GenerateCallback(customUi);
                if (callbacks == null || callbacks.Length == 0)
                {
                    MessageBox.Show(StringsResource.idsNoCallback, "Generate Callbacks", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }

                var window = new CallbackWindow(callbacks.ToString())
                {
                    Owner = this
                };
                window.Show();
            }
            catch (Exception ex)
            {
                Debug.Assert(false, ex.Message);
            }
        }
        public void GeneratedCallbacksAreCorrect(string xml, string expected)
        {
            // Arrange
            var doc = new XmlDocument();

            doc.LoadXml(xml);

            // Act
            var callbacks = CallbacksBuilder.GenerateCallback(doc)?
                            .ToString()
                            .Trim();

            // Assert
            Assert.AreEqual(expected, callbacks);
        }
        public void GeneratedCallbacksAreCorrect(string xml, string expected)
        {
            // Arrange
            var doc = new XmlDocument {
                XmlResolver = null
            };

            using (var stringReader = new StringReader(xml))
                using (var xmlReader = XmlReader.Create(stringReader, new XmlReaderSettings {
                    XmlResolver = null
                }))
                {
                    doc.Load(xmlReader);
                }

            // Act
            var callbacks = CallbacksBuilder.GenerateCallback(doc)?
                            .ToString()
                            .Trim();

            // Assert
            Assert.AreEqual(expected, callbacks);
        }