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;
		}
Exemplo n.º 2
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()
		{
			expectedSearchedFolders = new string[] { @"c:\sharpdevelop\data-dir\schemas",
				@"c:\users\user\sharpdevelop\schemas" };

			string[] readOnlySchemaFolders = new String[] { @"c:\folder-does-not-exist",
				@"c:\sharpdevelop\data-dir\schemas" };
			
			fileSystem = new MockFileSystem();
			factory = new MockXmlSchemaCompletionDataFactory();
			registeredXmlSchemas = new RegisteredXmlSchemas(readOnlySchemaFolders, @"c:\users\user\sharpdevelop\schemas", fileSystem, factory);
			fileSystem.AddExistingFolders(expectedSearchedFolders);
			registeredXmlSchemas.ReadSchemas();
		}
        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();
        }