From 18c56eaf4975a23da897596216dceacbec146996 Mon Sep 17 00:00:00 2001 From: Marius Ungureanu Date: Fri, 23 Sep 2016 16:32:03 +0300 Subject: [MSBuild] Fix the tests so it sets env var on fixture setup. This more closely mimicks XS behaviour which doesn't really change its env vars during usage. That way we fix the tests that would've failed with a static dictionary cache. --- .../UnitTests/MonoDevelop.Projects/MSBuildTests.cs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs b/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs index 400476d20c..3ca18aefa0 100644 --- a/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs +++ b/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs @@ -44,6 +44,14 @@ namespace MonoDevelop.Projects [TestFixture] public class MSBuildTests : TestBase { + [TestFixtureSetUp] + public void SetUp () + { + string dir = Path.GetDirectoryName (typeof (Project).Assembly.Location); + Environment.SetEnvironmentVariable ("HHH", "EnvTest"); + Environment.SetEnvironmentVariable ("SOME_PLACE", dir); + } + [Test ()] public async Task LoadSaveBuildConsoleProject () { @@ -425,10 +433,6 @@ namespace MonoDevelop.Projects //[Ignore ("xbuild bug. It is not returning correct values for evaluated-items-without-condition list")] public async Task SaveItemsWithProperties () { - string dir = Path.GetDirectoryName (typeof (Project).Assembly.Location); - Environment.SetEnvironmentVariable ("HHH", "EnvTest"); - Environment.SetEnvironmentVariable ("SOME_PLACE", dir); - string solFile = Util.GetSampleProject ("property-evaluation-test", "property-evaluation-test.sln"); Solution sol = await Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile) as Solution; var p = (DotNetProject)sol.GetAllProjects ().First (); @@ -445,10 +449,6 @@ namespace MonoDevelop.Projects [Test] public async Task SaveItemsWithProperties2 () { - string dir = Path.GetDirectoryName (typeof (Project).Assembly.Location); - Environment.SetEnvironmentVariable ("HHH", "EnvTest"); - Environment.SetEnvironmentVariable ("SOME_PLACE", dir); - string projFile = Util.GetSampleProject ("property-save-test", "property-save-test.csproj"); Project p = await Services.ProjectService.ReadSolutionItem (Util.GetMonitor (), projFile) as Project; @@ -465,8 +465,6 @@ namespace MonoDevelop.Projects public async Task EvaluateProperties () { string dir = Path.GetDirectoryName (typeof (Project).Assembly.Location); - Environment.SetEnvironmentVariable ("HHH", "EnvTest"); - Environment.SetEnvironmentVariable ("SOME_PLACE", dir); string solFile = Util.GetSampleProject ("property-evaluation-test", "property-evaluation-test.sln"); Solution sol = await Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile) as Solution; @@ -499,10 +497,6 @@ namespace MonoDevelop.Projects [Test] public async Task EvaluatePropertiesWithConditionalGroup () { - string dir = Path.GetDirectoryName (typeof (Project).Assembly.Location); - Environment.SetEnvironmentVariable ("HHH", "EnvTest"); - Environment.SetEnvironmentVariable ("SOME_PLACE", dir); - string solFile = Util.GetSampleProject ("property-evaluation-test", "property-evaluation-test.sln"); Solution sol = await Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile) as Solution; var p = (DotNetProject)sol.GetAllProjects ().First (); -- cgit v1.2.3