コード例 #1
0
        public void XmlSchemaFileAssociationCanBeRetrievedAfterAddingToPanel()
        {
            XmlSchemaFileAssociationListItem item = new XmlSchemaFileAssociationListItem(".xml", "namespace-uri", "prefix");
            int index = panel.AddXmlSchemaFileAssociationListItem(item);

            Assert.AreSame(item, panel.GetXmlSchemaFileAssociationListItem(index));
        }
コード例 #2
0
        public void XmlSchemaFileAssociationCountMatchesNumItemsAddedToPanel()
        {
            XmlSchemaFileAssociationListItem item = new XmlSchemaFileAssociationListItem(".xml", "namespace-uri", "prefix");

            panel.AddXmlSchemaFileAssociationListItem(item);

            Assert.AreEqual(1, panel.XmlSchemaFileAssociationListItemCount);
        }
コード例 #3
0
        public void SelectedXmlSchemaFileAssocationIndexChangesSelectedItem()
        {
            XmlSchemaFileAssociationListItem xmlSchemaAssociation = new XmlSchemaFileAssociationListItem(".xml", "namespace-uri", "x");

            panel.AddXmlSchemaFileAssociationListItem(xmlSchemaAssociation);
            panel.SelectedXmlSchemaFileAssociationListItemIndex = 0;

            Assert.AreSame(xmlSchemaAssociation, panel.GetSelectedXmlSchemaFileAssociationListItem());
        }
        public void NamespacePrefixTextBoxChangedModifiesXmlFileAssociationNamespacePrefix()
        {
            panel.SetSelectedSchemaNamespacePrefix("modified-prefix");
            schemasEditor.SchemaNamespacePrefixChanged();

            XmlSchemaFileAssociationListItem item = panel.GetSelectedXmlSchemaFileAssociationListItem() as XmlSchemaFileAssociationListItem;

            Assert.AreEqual("modified-prefix", item.NamespacePrefix);
        }
コード例 #5
0
        public void XmlSchemaFileAssociationsCanBeSorted()
        {
            panel.AddXmlSchemaFileAssociationListItem(new XmlSchemaFileAssociationListItem(".xml", "namespace-uri", "x"));
            panel.AddXmlSchemaFileAssociationListItem(new XmlSchemaFileAssociationListItem(".abc", "namespace-uri-abc", "abc"));
            panel.AddXmlSchemaFileAssociationListSortDescription("Extension", ListSortDirection.Ascending);

            XmlSchemaFileAssociationListItem listItem = panel.GetXmlSchemaFileAssociationListItem(0) as XmlSchemaFileAssociationListItem;

            Assert.AreEqual(".abc", listItem.Extension);
        }
コード例 #6
0
        public void WhenSelectedSchemaNamespacePrefixModifiedSchemasEditorSchemaNamespacePrefixChangedMethodCalled()
        {
            XmlSchemaFileAssociationListItem xmlSchemaAssociation = new XmlSchemaFileAssociationListItem(".xml", "namespace-uri", "x");

            panel.AddXmlSchemaFileAssociationListItem(xmlSchemaAssociation);
            panel.SelectedXmlSchemaFileAssociationListItemIndex = 0;

            bool methodCalled = false;

            panel.SetMethodToCallWhenSchemaNamespacePrefixChanged(delegate() { methodCalled = true; });
            panel.SetSelectedSchemaNamespacePrefix("test");

            Assert.IsTrue(methodCalled);
        }
コード例 #7
0
        public void Init()
        {
            factory = new MockXmlSchemaCompletionDataFactory();
            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], String.Empty, null, factory);
            properties           = new Properties();
            DefaultXmlSchemaFileAssociations defaultAssociations = new DefaultXmlSchemaFileAssociations(new AddInTreeNode());

            associations = new XmlSchemaFileAssociations(properties, defaultAssociations, new XmlSchemaCompletionCollection());
            schemasPanel = new XmlSchemasPanel(registeredXmlSchemas, new string[0], associations, factory);

            schemaListBox          = schemasPanel.FindName("schemaListBox") as ListBox;
            fileExtensionComboBox  = schemasPanel.FindName("fileExtensionComboBox") as ComboBox;
            removeSchemaButton     = schemasPanel.FindName("removeSchemaButton") as Button;
            namespacePrefixTextBox = schemasPanel.FindName("namespacePrefixTextBox") as TextBox;
            schemaNamespaceTextBox = schemasPanel.FindName("schemaNamespaceTextBox") as TextBox;

            schemaListItem = new XmlSchemaListItem("a");
            schemaListBox.Items.Add(schemaListItem);

            fileAssociationItem = new XmlSchemaFileAssociationListItem(".xsd", "ns", "a");
            schemasPanel.AddXmlSchemaFileAssociationListItem(fileAssociationItem);
        }
        public void FileAssociationNamespaceUpdated()
        {
            XmlSchemaFileAssociationListItem item = panel.GetSelectedXmlSchemaFileAssociationListItem() as XmlSchemaFileAssociationListItem;

            Assert.AreEqual("http://new", item.NamespaceUri);
        }
コード例 #9
0
 public int AddXmlSchemaFileAssociationListItem(XmlSchemaFileAssociationListItem item)
 {
     return(schemaFileAssociationsComboBox.Items.Add(item));
 }
        public void FirstXmlFileExtensionIsBar()
        {
            XmlSchemaFileAssociationListItem expectedItem = new XmlSchemaFileAssociationListItem(".bar", "http://bar", "b");

            Assert.AreEqual(expectedItem.ToString(), panel.GetXmlSchemaFileAssociationListItem(0).ToString());
        }
        public void LastXmlFileExtensionIsXml()
        {
            XmlSchemaFileAssociationListItem expectedItem = new XmlSchemaFileAssociationListItem(".xml", "http://xml", String.Empty);

            Assert.AreEqual(expectedItem.ToString(), panel.GetXmlSchemaFileAssociationListItem(2).ToString());
        }