This commit is contained in:
Kirill Osenkov 2021-08-05 18:33:38 -07:00
Родитель 6771b22ad1
Коммит 43d1cb9f9a
2 изменённых файлов: 25 добавлений и 16 удалений

Просмотреть файл

@ -13,7 +13,8 @@
<ProjectReference Include="..\external\MiniEditor\Microsoft.VisualStudio.MiniEditor\Microsoft.VisualStudio.MiniEditor.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Schema\**\*" />
<Compile Remove="Schema\SchemaAssociationTests.cs" />
<Compile Remove="Schema\XmlSchemaNamespaceTests.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="Schema\xhtml1-strict.xsd" />
@ -23,6 +24,10 @@
<EmbeddedResource Include="Schema\xhtml1-strict.xsd" LogicalName="xhtml1-strict.xsd" />
<EmbeddedResource Include="Schema\XMLSchema.xsd" LogicalName="XMLSchema.xsd" />
</ItemGroup>
<ItemGroup>
<None Include="Schema\SchemaAssociationTests.cs" />
<None Include="Schema\XmlSchemaNamespaceTests.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="NUnit" Version="3.12.0" />

Просмотреть файл

@ -19,12 +19,12 @@ namespace MonoDevelop.Xml.Tests.Utils
SchemaIncludeTestFixtureHelper()
{
}
static SchemaIncludeTestFixtureHelper()
{
schemaPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "XmlEditorTests");
}
/// <summary>
/// Creates a schema with the given filename
/// </summary>
@ -44,19 +44,20 @@ namespace MonoDevelop.Xml.Tests.Utils
/// </summary>
/// <param name="mainSchema">The main schema's xml.</param>
/// <param name="includedSchema">The included schema's xml.</param>
internal static XmlSchemaCompletionProvider CreateSchemaCompletionDataObject (string mainSchema, string includedSchema)
internal static XmlSchemaCompletionProvider CreateSchemaCompletionDataObject(string mainSchema, string includedSchema)
{
if (!Directory.Exists (schemaPath)) {
Directory.CreateDirectory (schemaPath);
if (!Directory.Exists(schemaPath))
{
Directory.CreateDirectory(schemaPath);
}
CreateSchema (Path.Combine (schemaPath, mainSchemaFileName), mainSchema);
CreateSchema (Path.Combine (schemaPath, includedSchemaFileName), includedSchema);
CreateSchema(Path.Combine(schemaPath, mainSchemaFileName), mainSchema);
CreateSchema(Path.Combine(schemaPath, includedSchemaFileName), includedSchema);
// Parse schema.
string schemaFileName = Path.Combine (schemaPath, mainSchemaFileName);
string baseUri = XmlSchemaCompletionProvider.GetUri (schemaFileName);
return new XmlSchemaCompletionProvider (baseUri, schemaFileName);
string schemaFileName = Path.Combine(schemaPath, mainSchemaFileName);
string baseUri = XmlSchemaCompletionProvider.GetUri(schemaFileName);
return new XmlSchemaCompletionProvider(baseUri, schemaFileName);
}
/// <summary>
@ -66,16 +67,19 @@ namespace MonoDevelop.Xml.Tests.Utils
{
// Delete the created schemas.
string fileName = Path.Combine(schemaPath, mainSchemaFileName);
if (File.Exists(fileName)) {
if (File.Exists(fileName))
{
File.Delete(fileName);
}
fileName = Path.Combine(schemaPath, includedSchemaFileName);
if (File.Exists(fileName)) {
if (File.Exists(fileName))
{
File.Delete(fileName);
}
if (Directory.Exists(schemaPath)) {
if (Directory.Exists(schemaPath))
{
Directory.Delete(schemaPath);
}
}