You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
@@ -39,6 +39,8 @@ using System.ServiceModel.Description;
|
||||
|
||||
using SysConfig = System.Configuration.Configuration;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.MetadataTests {
|
||||
|
||||
public abstract class TestContext {
|
||||
@@ -111,20 +113,12 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
|
||||
|
||||
public static MetadataSet LoadMetadata (string name)
|
||||
{
|
||||
#if USE_EMBEDDED_METADATA
|
||||
return LoadMetadataFromResource (name);
|
||||
#else
|
||||
return LoadMetadataFromFile (name);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static XmlDocument LoadConfiguration (string name)
|
||||
{
|
||||
#if USE_EMBEDDED_METADATA
|
||||
return LoadConfigurationFromResource (name);
|
||||
#else
|
||||
return LoadConfigurationFromFile (name);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void SaveMetadata (string name, MetadataSet metadata)
|
||||
@@ -137,32 +131,9 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
|
||||
var asm = Assembly.GetExecutingAssembly ();
|
||||
if (!name.EndsWith (".xml"))
|
||||
name = name + ".xml";
|
||||
var uri = new Uri (asm.CodeBase);
|
||||
// Run from mcs/class/lib/<profile>
|
||||
var path = Path.GetDirectoryName (uri.AbsolutePath);
|
||||
path = Directory.GetParent (path).Parent.Parent.FullName;
|
||||
path = Path.Combine (path, "System.ServiceModel");
|
||||
path = Path.Combine (path, "Test");
|
||||
path = Path.Combine (path, "MetadataTests");
|
||||
path = Path.Combine (path, "Resources");
|
||||
var filename = Path.Combine (path, name);
|
||||
using (var stream = new StreamReader (filename)) {
|
||||
var reader = new XmlTextReader (stream);
|
||||
return MetadataSet.ReadFrom (reader);
|
||||
}
|
||||
}
|
||||
|
||||
public static MetadataSet LoadMetadataFromResource (string name)
|
||||
{
|
||||
var asm = Assembly.GetExecutingAssembly ();
|
||||
if (!name.EndsWith (".xml"))
|
||||
name = name + ".xml";
|
||||
|
||||
var resname = "MetadataTests.Resources." + name;
|
||||
using (var stream = asm.GetManifestResourceStream (resname)) {
|
||||
if (stream == null)
|
||||
throw new InvalidOperationException (
|
||||
"No such resource: " + name);
|
||||
var filename = TestResourceHelper.GetFullPathOfResource ("Test/MetadataTests/Resources/" + name);
|
||||
using (var stream = new StreamReader (filename)) {
|
||||
var reader = new XmlTextReader (stream);
|
||||
return MetadataSet.ReadFrom (reader);
|
||||
}
|
||||
@@ -173,32 +144,9 @@ namespace MonoTests.System.ServiceModel.MetadataTests {
|
||||
var asm = Assembly.GetExecutingAssembly ();
|
||||
if (!name.EndsWith (".config"))
|
||||
name = name + ".config";
|
||||
var uri = new Uri (asm.CodeBase);
|
||||
var path = Path.GetDirectoryName (uri.AbsolutePath);
|
||||
path = Directory.GetParent (path).Parent.Parent.FullName;
|
||||
path = Path.Combine (path, "System.ServiceModel");
|
||||
path = Path.Combine (path, "Test");
|
||||
path = Path.Combine (path, "MetadataTests");
|
||||
path = Path.Combine (path, "Resources");
|
||||
var filename = Path.Combine (path, name);
|
||||
using (var stream = new StreamReader (filename)) {
|
||||
var xml = new XmlDocument ();
|
||||
xml.Load (stream);
|
||||
return xml;
|
||||
}
|
||||
}
|
||||
|
||||
public static XmlDocument LoadConfigurationFromResource (string name)
|
||||
{
|
||||
var asm = Assembly.GetExecutingAssembly ();
|
||||
if (!name.EndsWith (".config"))
|
||||
name = name + ".config";
|
||||
|
||||
var resname = "MetadataTests.Resources." + name;
|
||||
using (var stream = asm.GetManifestResourceStream (resname)) {
|
||||
if (stream == null)
|
||||
throw new InvalidOperationException (
|
||||
"No such resource: " + name);
|
||||
var filename = TestResourceHelper.GetFullPathOfResource ("Test/MetadataTests/Resources/" + name);
|
||||
using (var stream = new StreamReader (filename)) {
|
||||
var xml = new XmlDocument ();
|
||||
xml.Load (stream);
|
||||
return xml;
|
||||
|
Reference in New Issue
Block a user