diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-09-27 22:36:25 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-09-27 23:47:52 +0300 |
commit | 70a8bf5532bb8ea4c4d310d8e623f36b01d0ee0d (patch) | |
tree | 388fddcc362f6e08310a0c3bcaa7f076c435251a /mcs/class/Microsoft.Build/Test | |
parent | 1f3ab29158039d49c0e392ec580661ab8537e052 (diff) |
[Microsoft.Build] Switch tests to use embedded test resources
Also moved some xbuild test data to mcs/class/lib/net_4_x/tests/xbuild
Diffstat (limited to 'mcs/class/Microsoft.Build/Test')
-rw-r--r-- | mcs/class/Microsoft.Build/Test/FunctionalTest.cs | 14 | ||||
-rw-r--r-- | mcs/class/Microsoft.Build/Test/Microsoft.Build.Construction/ProjectRootElementTest.cs | 11 | ||||
-rw-r--r-- | mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectInstanceTest.cs | 1 | ||||
-rw-r--r-- | mcs/class/Microsoft.Build/Test/resources/FunctionalTestReferenceProject.csproj (renamed from mcs/class/Microsoft.Build/Test/FunctionalTestReferenceProject.csproj) | 0 | ||||
-rw-r--r-- | mcs/class/Microsoft.Build/Test/resources/FunctionalTestReferenceProject3.csproj (renamed from mcs/class/Microsoft.Build/Test/FunctionalTestReferenceProject3.csproj) | 0 | ||||
-rw-r--r-- | mcs/class/Microsoft.Build/Test/resources/Microsoft.Build.Test.csproj (renamed from mcs/class/Microsoft.Build/Test/Microsoft.Build.Test.csproj) | 0 | ||||
-rw-r--r-- | mcs/class/Microsoft.Build/Test/resources/Microsoft.Build.csproj (renamed from mcs/class/Microsoft.Build/Test/Microsoft.Build.csproj) | 0 |
7 files changed, 10 insertions, 16 deletions
diff --git a/mcs/class/Microsoft.Build/Test/FunctionalTest.cs b/mcs/class/Microsoft.Build/Test/FunctionalTest.cs index 4b6467a0701..b28ae3f69ae 100644 --- a/mcs/class/Microsoft.Build/Test/FunctionalTest.cs +++ b/mcs/class/Microsoft.Build/Test/FunctionalTest.cs @@ -36,6 +36,8 @@ using Microsoft.Build.Evaluation; using System.IO; using System.Globalization; +using MonoTests.Helpers; + namespace MonoTests.Microsoft.Build { [TestFixture] @@ -55,29 +57,27 @@ namespace MonoTests.Microsoft.Build project.Save (projectFileName); Assert.AreEqual (projectGuid, GetProjectId (project), "#01"); - FileAssert.AreEqual (String.Format ("Test{0}FunctionalTestReferenceProject.csproj", - Path.DirectorySeparatorChar), String.Format ("Test{0}FunctionalTestProject.csproj", - Path.DirectorySeparatorChar), "#02"); + FileAssert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/FunctionalTestReferenceProject.csproj"), + String.Format ("Test{0}FunctionalTestProject.csproj", Path.DirectorySeparatorChar), "#02"); } [Test] public void TestLoadAndSave () { - var project = ProjectRootElement.Open (Path.Combine ("Test", "Microsoft.Build.csproj")); + var project = ProjectRootElement.Open (TestResourceHelper.GetFullPathOfResource ("Test/resources/Microsoft.Build.csproj")); var projectFileName = String.Format ("Test{0}FunctionalTestProject2.csproj", Path.DirectorySeparatorChar); project.Save (projectFileName); Assert.AreEqual (new Guid ("{B2012E7F-8F8D-4908-8045-413F2BD1022D}"), GetProjectId (project), "#03"); - FileAssert.AreEqual (Path.Combine ("Test", "Microsoft.Build.csproj"), projectFileName, "#04"); + FileAssert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/Microsoft.Build.csproj"), projectFileName, "#04"); } [Test] public void TestLoadAndSave3 () { - var referenceProject = String.Format ( - "Test{0}FunctionalTestReferenceProject3.csproj", Path.DirectorySeparatorChar); + var referenceProject = TestResourceHelper.GetFullPathOfResource ("Test/resources/FunctionalTestReferenceProject3.csproj"); var project = ProjectRootElement.Open (referenceProject); var projectFileName = String.Format ("Test{0}FunctionalTestProject3.csproj", Path.DirectorySeparatorChar); diff --git a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Construction/ProjectRootElementTest.cs b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Construction/ProjectRootElementTest.cs index 7d107c20a9b..a4e25e236fc 100644 --- a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Construction/ProjectRootElementTest.cs +++ b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Construction/ProjectRootElementTest.cs @@ -31,12 +31,8 @@ namespace MonoTests.Microsoft.Build.Construction // This creator does not fill FullPath... var root = ProjectRootElement.Create (xml); - // Expected to run from mcs/class/lib/profile/tests - var dir_name = Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath); - var namespace_path = Path.Combine (Directory.GetParent (dir_name).Parent.Parent.FullName, "Microsoft.Build"); - Assert.IsNull (root.FullPath, "#2"); - Assert.AreEqual (namespace_path, root.DirectoryPath, "#3"); + Assert.AreEqual (Environment.CurrentDirectory, root.DirectoryPath, "#3"); } [Test] @@ -45,10 +41,7 @@ namespace MonoTests.Microsoft.Build.Construction var root = ProjectRootElement.Create (); root.FullPath = "test" + Path.DirectorySeparatorChar + "foo.xml"; - // Expected to run from mcs/class/lib/profile/tests - var dir_name = Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath); - var namespace_path = Path.Combine (Directory.GetParent (dir_name).Parent.Parent.FullName, "Microsoft.Build"); - var full = Path.Combine (namespace_path, "test", "foo.xml"); + var full = Path.Combine (Environment.CurrentDirectory, "test", "foo.xml"); Assert.AreEqual (full, root.FullPath, "#1"); Assert.AreEqual (Path.GetDirectoryName (full), root.DirectoryPath, "#1"); } diff --git a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectInstanceTest.cs b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectInstanceTest.cs index c4fe2401bd5..6f24d209933 100644 --- a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectInstanceTest.cs +++ b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/ProjectInstanceTest.cs @@ -162,6 +162,7 @@ namespace MonoTests.Microsoft.Build.Execution public void FirstUsingTaskTakesPrecedenceCommon (bool importFirst, bool buildShouldSucceed) { string thisAssembly = new Uri (GetType ().Assembly.CodeBase).LocalPath; + Directory.CreateDirectory ("Test"); string filename = "Test/ProjectTargetInstanceTest.FirstUsingTaskTakesPrecedence.Import.proj"; string imported_xml = string.Format (@"<Project DefaultTargets='Foo' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'> <UsingTask TaskName='MonoTests.Microsoft.Build.Execution.MyTask' AssemblyFile='{0}' /> diff --git a/mcs/class/Microsoft.Build/Test/FunctionalTestReferenceProject.csproj b/mcs/class/Microsoft.Build/Test/resources/FunctionalTestReferenceProject.csproj index a2a89e080d4..a2a89e080d4 100644 --- a/mcs/class/Microsoft.Build/Test/FunctionalTestReferenceProject.csproj +++ b/mcs/class/Microsoft.Build/Test/resources/FunctionalTestReferenceProject.csproj diff --git a/mcs/class/Microsoft.Build/Test/FunctionalTestReferenceProject3.csproj b/mcs/class/Microsoft.Build/Test/resources/FunctionalTestReferenceProject3.csproj index 0487bc6ffb4..0487bc6ffb4 100644 --- a/mcs/class/Microsoft.Build/Test/FunctionalTestReferenceProject3.csproj +++ b/mcs/class/Microsoft.Build/Test/resources/FunctionalTestReferenceProject3.csproj diff --git a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Test.csproj b/mcs/class/Microsoft.Build/Test/resources/Microsoft.Build.Test.csproj index d9860f74506..d9860f74506 100644 --- a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Test.csproj +++ b/mcs/class/Microsoft.Build/Test/resources/Microsoft.Build.Test.csproj diff --git a/mcs/class/Microsoft.Build/Test/Microsoft.Build.csproj b/mcs/class/Microsoft.Build/Test/resources/Microsoft.Build.csproj index aa185cd1a34..aa185cd1a34 100644 --- a/mcs/class/Microsoft.Build/Test/Microsoft.Build.csproj +++ b/mcs/class/Microsoft.Build/Test/resources/Microsoft.Build.csproj |