Example #1
0
        public void AddXmlSchemaListItemAddsItemToListBox()
        {
            XmlSchemaListItem newItem = new XmlSchemaListItem("new");
            int index = schemasPanel.AddXmlSchemaListItem(newItem);

            Assert.AreSame(newItem, schemaListBox.Items[index]);
        }
Example #2
0
        public void ScrollIntoViewXmlSchemaListItemIsSaved()
        {
            XmlSchemaListItem item = new XmlSchemaListItem("a");

            panel.ScrollXmlSchemaListItemIntoView(item);
            Assert.AreSame(item, panel.XmlSchemaListItemScrolledIntoView);
        }
Example #3
0
        public void XmlSchemaListItemCanBeRetrievedAfterAddingToPanel()
        {
            XmlSchemaListItem item = new XmlSchemaListItem("namespace", true);

            panel.AddXmlSchemaListItem(item);

            Assert.AreSame(item, panel.GetXmlSchemaListItem(0));
        }
Example #4
0
        public void SettingXmlSchemaListSelectedIndexChangesSelectedXmlSchemaListItem()
        {
            XmlSchemaListItem item = new XmlSchemaListItem("namespace", true);

            panel.AddXmlSchemaListItem(item);
            panel.SelectedXmlSchemaListItemIndex = 0;

            Assert.AreEqual("namespace", panel.GetSelectedXmlSchemaListItem().ToString());
        }
Example #5
0
        public void RemoveSchemaListItem()
        {
            XmlSchemaListItem itemToRemove = new XmlSchemaListItem("b");

            panel.AddXmlSchemaListItem(itemToRemove);
            panel.AddXmlSchemaListItem(new XmlSchemaListItem("a"));
            panel.RemoveXmlSchemaListItem(itemToRemove);

            Assert.AreEqual(1, panel.XmlSchemaListItemCount);
        }
Example #6
0
        public void SelectXmlSchemaByNamespace()
        {
            panel.AddXmlSchemaListItem(new XmlSchemaListItem("a"));
            XmlSchemaListItem listItemToBeSelected = new XmlSchemaListItem("b");

            panel.AddXmlSchemaListItem(listItemToBeSelected);

            panel.SelectSchemaListItem("b");

            Assert.AreSame(listItemToBeSelected, panel.GetSelectedXmlSchemaListItem());
        }
 public void SelectSchemaListItem(string namespaceUri)
 {
     for (int index = 0; index < schemaListBox.Items.Count; ++index)
     {
         XmlSchemaListItem item = schemaListBox.Items[index] as XmlSchemaListItem;
         if (item.NamespaceUri == namespaceUri)
         {
             schemaListBox.SelectedIndex = index;
             return;
         }
     }
     schemaListBox.SelectedIndex = -1;
 }
Example #8
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 RemoveXmlSchemaListItem(XmlSchemaListItem schema)
 {
     schemaListBox.Items.Remove(schema);
 }
 public int AddXmlSchemaListItem(XmlSchemaListItem schema)
 {
     return(schemaListBox.Items.Add(schema));
 }
 public void ScrollXmlSchemaListItemIntoView(XmlSchemaListItem schemaListItem)
 {
     xmlSchemaListItemScrolledIntoView = schemaListItem;
 }