public void TestSchemaShouldStillExistAfterAddingTestSchemaAgainAfterBeingRemoved()
        {
            panel.OpenFileDialogResultToReturn   = true;
            panel.OpenFileDialogFileNameToReturn = @"c:\users\user\schemas\test.xsd";
            factory.AddSchemaXml(panel.OpenFileDialogFileNameToReturn, testSchemaXml);
            schemasEditor.AddSchemaFromFileSystem();
            schemasEditor.SaveOptions();

            Assert.IsTrue(registeredXmlSchemas.SchemaExists("http://test"));
        }
Beispiel #2
0
        public void AnotherSchemaAddedToPanelIsSortedByNamespaceInSchemasList()
        {
            string fileName = @"c:\projects\b.xsd";

            factory.AddSchemaXml(fileName,
                                 "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://new' />");

            panel.OpenFileDialogFileNameToReturn = fileName;
            panel.OpenFileDialogResultToReturn   = true;

            schemasEditor.AddSchemaFromFileSystem();

            string[] expectedSchemas = new string[] { "http://new", "http://test" };
            Assert.AreEqual(expectedSchemas, panel.GetXmlSchemaListItemNamespaces());
        }
Beispiel #3
0
        public void Init()
        {
            MockFileSystem fileSystem = new MockFileSystem();

            factory = new MockXmlSchemaCompletionDataFactory();
            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], @"c:\users\user\sharpdevelop\schemas", fileSystem, factory);
            XmlSchemaCompletionCollection schemas      = new XmlSchemaCompletionCollection();
            XmlSchemaFileAssociations     associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(null), schemas);

            panel = new MockXmlSchemasPanel();

            schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[0], associations, panel, factory);
            schemasEditor.LoadOptions();

            panel.OpenFileDialogFileNameToReturn = @"c:\temp\a.xsd";
            panel.OpenFileDialogResultToReturn   = false;

            schemasEditor.AddSchemaFromFileSystem();
        }
        public void Init()
        {
            fileSystem           = new MockFileSystem();
            factory              = new MockXmlSchemaCompletionDataFactory();
            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], @"c:\users\user\sharpdevelop\schemas", fileSystem, factory);

            string testSchemaXml       = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />";
            XmlSchemaCompletion schema = new XmlSchemaCompletion(new StringReader(testSchemaXml));

            schema.IsReadOnly = false;
            registeredXmlSchemas.Schemas.Add(schema);

            XmlSchemaFileAssociations associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(null), registeredXmlSchemas.Schemas);

            associations.SetSchemaFileAssociation(new XmlSchemaFileAssociation(".test", "http://test"));
            panel = new MockXmlSchemasPanel();

            schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[] { ".test" }, associations, panel, factory);
            schemasEditor.LoadOptions();

            string newXmlSchemaFileName = @"c:\projects\new.xsd";
            string newSchemaXml         = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://new' />";

            factory.AddSchemaXml(newXmlSchemaFileName, newSchemaXml);

            panel.OpenFileDialogFileNameToReturn = newXmlSchemaFileName;
            panel.OpenFileDialogResultToReturn   = true;

            // Add schema from file system to ensure that the list of schemas shown to the
            // user is from the list of schemas in the list box when changing the association
            // to a file extension
            schemasEditor.AddSchemaFromFileSystem();

            panel.SelectedXmlSchemaFileAssociationListItemIndex = 0;
            schemasEditor.XmlSchemaFileAssociationFileExtensionSelectionChanged();

            panel.SelectXmlSchemaWindowDialogResultToReturn = true;
            panel.SelectXmlSchemaWindowNamespaceToReturn    = "http://new";
            schemasEditor.ChangeSchemaAssociation();
        }
Beispiel #5
0
        public void Init()
        {
            fileSystem           = new MockFileSystem();
            factory              = new MockXmlSchemaCompletionDataFactory();
            registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], @"c:\users\user\sharpdevelop\schemas", fileSystem, factory);
            XmlSchemaCompletionCollection schemas      = new XmlSchemaCompletionCollection();
            XmlSchemaFileAssociations     associations = new XmlSchemaFileAssociations(new Properties(), new DefaultXmlSchemaFileAssociations(null), schemas);

            panel = new MockXmlSchemasPanel();

            schemasEditor = new RegisteredXmlSchemasEditor(registeredXmlSchemas, new string[0], associations, panel, factory);
            schemasEditor.LoadOptions();

            newXmlSchemaFileName = @"c:\projects\a.xsd";
            factory.AddSchemaXml(newXmlSchemaFileName,
                                 "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />");

            panel.OpenFileDialogFileNameToReturn = newXmlSchemaFileName;
            panel.OpenFileDialogResultToReturn   = true;

            schemasEditor.AddSchemaFromFileSystem();
        }
Beispiel #6
0
 void AddSchema(string schema)
 {
     factory.AddSchemaXml(panel.OpenFileDialogFileNameToReturn, schema);
     schemasEditor.AddSchemaFromFileSystem();
 }