public void Init()
		{
			string sharpDevelopSchemaFolder = @"c:\sharpdevelop\schemas";
			string[] schemaFolders = new string[] { @"c:\sharpdevelop\schemas" };
			string userDefinedSchemaFolder = @"c:\users\user\schemas";
			
			fileSystem = new MockFileSystem();
			factory = new MockXmlSchemaCompletionDataFactory();
			registeredXmlSchemas = new RegisteredXmlSchemas(schemaFolders, userDefinedSchemaFolder, fileSystem, factory);
			
			fileSystem.AddExistingFolders(schemaFolders);
			fileSystem.AddExistingFolder(userDefinedSchemaFolder);
			
			addinSchemaFileName = Path.Combine(sharpDevelopSchemaFolder, "addin.xsd");
			string[] sharpDevelopSchemaFiles = new string[] { addinSchemaFileName };
			fileSystem.AddDirectoryFiles(sharpDevelopSchemaFolder, sharpDevelopSchemaFiles);
			
			testSchemaFileName = Path.Combine(userDefinedSchemaFolder, "test.xsd");
			string[] userDefinedSchemaFiles = new string[] { testSchemaFileName };
			fileSystem.AddDirectoryFiles(userDefinedSchemaFolder, userDefinedSchemaFiles);
			
			factory.AddSchemaXml(addinSchemaFileName,
				"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://addin' />");
			factory.AddSchemaXml(testSchemaFileName,
				"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />");
			
			fileSystem.AddExistingFile(addinSchemaFileName, true);
			fileSystem.AddExistingFile(testSchemaFileName, false);
			
			registeredXmlSchemas.ReadSchemas();
			
			userSchemaRemovedEventFiredCount = 0;
			registeredXmlSchemas.UserDefinedSchemaRemoved += UserSchemaRemoved;
		}
		public void Init()
		{
			string userDefinedSchemaFolder = @"c:\users\user\schemas";
			
			fileSystem = new MockFileSystem();
			factory = new MockXmlSchemaCompletionDataFactory();
			registeredXmlSchemas = new RegisteredXmlSchemas(new string[0], userDefinedSchemaFolder, fileSystem, factory);
			
			fileSystem.AddExistingFolder(userDefinedSchemaFolder);
			
			string testSchemaFileName = Path.Combine(userDefinedSchemaFolder, "test.xsd");
			duplicateTestSchemaFileName = Path.Combine(userDefinedSchemaFolder, "test2.xsd");
			string[] userDefinedSchemaFiles = new string[] { testSchemaFileName, duplicateTestSchemaFileName };
			fileSystem.AddDirectoryFiles(userDefinedSchemaFolder, userDefinedSchemaFiles);
			
			factory.AddSchemaXml(testSchemaFileName,
				"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />");
			
			factory.AddSchemaXml(duplicateTestSchemaFileName,
				"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://test' />");

			fileSystem.AddExistingFile(testSchemaFileName, false);
			fileSystem.AddExistingFile(duplicateTestSchemaFileName, false);
			
			registeredXmlSchemas.ReadSchemas();
		}
Exemplo n.º 3
0
		public void Init()
		{
			fileSystem = new MockFileSystem();
			tempDirectoryFiles = new string[] { @"c:\temp\a.txt", @"c:\temp\b.txt" };
			fileSystem.AddDirectoryFiles(@"c:\temp", tempDirectoryFiles);	
			
			string[] existingFolders = new string[] { @"c:\temp", @"c:\projects" };
			fileSystem.AddExistingFolders(existingFolders);
		}
        public void Init()
        {
            string[] schemaFolders = new string[] { @"d:\projects\schemas" };

            exceptionThrownWhenReadingSchema = new ApplicationException("Read schema failed.");

            factory = new MockXmlSchemaCompletionDataFactory();
            factory.ExceptionToThrowWhenCreateXmlSchemaCalled = exceptionThrownWhenReadingSchema;

            fileSystem = new MockFileSystem();
            fileSystem.AddExistingFolders(schemaFolders);

            string[] sharpDevelopSchemaFiles = new string[] { @"d:\projects\schemas\addin.xsd" };
            fileSystem.AddDirectoryFiles(@"d:\projects\schemas", sharpDevelopSchemaFiles);

            registeredXmlSchemas = new RegisteredXmlSchemas(schemaFolders, String.Empty, fileSystem, factory);
            registeredXmlSchemas.ReadSchemas();
        }