From afadf8f2b2e23ea1819a57e81c124ec185afa5d4 Mon Sep 17 00:00:00 2001
From: NextTurn <45985406+NextTurn@users.noreply.github.com>
Date: Sat, 8 Dec 2018 00:00:00 +0800
Subject: [PATCH] Fix tests
---
src/Test/winswTests/Configuration/ExamplesTest.cs | 2 +-
src/Test/winswTests/NunitTest.nunit | 4 ++--
src/Test/winswTests/Util/ProcessHelperTest.cs | 8 ++++----
src/Test/winswTests/winswTests.csproj | 2 ++
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/Test/winswTests/Configuration/ExamplesTest.cs b/src/Test/winswTests/Configuration/ExamplesTest.cs
index f501bdf..454239b 100644
--- a/src/Test/winswTests/Configuration/ExamplesTest.cs
+++ b/src/Test/winswTests/Configuration/ExamplesTest.cs
@@ -45,7 +45,7 @@ namespace winswTests.Configuration
private ServiceDescriptor doLoad(string exampleName) {
var dir = Directory.GetCurrentDirectory();
- string path = dir + "\\..\\..\\..\\..\\..\\examples\\sample-" + exampleName + ".xml";
+ string path = Path.GetFullPath(dir + "\\..\\..\\..\\..\\..\\..\\examples\\sample-" + exampleName + ".xml");
if (!File.Exists(path))
{
throw new FileNotFoundException("Cannot find the XML file " + path, path);
diff --git a/src/Test/winswTests/NunitTest.nunit b/src/Test/winswTests/NunitTest.nunit
index 6bf5283..2231d59 100644
--- a/src/Test/winswTests/NunitTest.nunit
+++ b/src/Test/winswTests/NunitTest.nunit
@@ -1,9 +1,9 @@
-
+
-
+
diff --git a/src/Test/winswTests/Util/ProcessHelperTest.cs b/src/Test/winswTests/Util/ProcessHelperTest.cs
index 1bbcf7d..44b5b80 100644
--- a/src/Test/winswTests/Util/ProcessHelperTest.cs
+++ b/src/Test/winswTests/Util/ProcessHelperTest.cs
@@ -18,6 +18,8 @@ namespace winswTests.Util
[Test]
public void ShouldPropagateVariablesInUppercase()
{
+ Environment.SetEnvironmentVariable("TEST_KEY", "TEST_VALUE");
+
var tmpDir = FilesystemTestHelper.CreateTmpDirectory();
String envFile = Path.Combine(tmpDir, "env.properties");
String scriptFile = Path.Combine(tmpDir, "printenv.bat");
@@ -40,12 +42,10 @@ namespace winswTests.Util
String[] keys = new String[envVars.Count];
envVars.Keys.CopyTo(keys, 0);
String availableVars = "[" + String.Join(",", keys) + "]";
- Assert.That(envVars.ContainsKey("PROCESSOR_ARCHITECTURE"), "No PROCESSOR_ARCHITECTURE in the injected vars: " + availableVars);
- Assert.That(envVars.ContainsKey("COMPUTERNAME"), "No COMPUTERNAME in the injected vars: " + availableVars);
- Assert.That(envVars.ContainsKey("PATHEXT"), "No PATHEXT in the injected vars: " + availableVars);
+ Assert.That(envVars.ContainsKey("TEST_KEY"), "No TEST_KEY in the injected vars: " + availableVars);
// And just ensure that the parsing logic is case-sensitive
- Assert.That(!envVars.ContainsKey("computername"), "Test error: the environment parsing logic is case-insensitive");
+ Assert.That(!envVars.ContainsKey("test_key"), "Test error: the environment parsing logic is case-insensitive");
}
diff --git a/src/Test/winswTests/winswTests.csproj b/src/Test/winswTests/winswTests.csproj
index e5a4780..9587d6c 100644
--- a/src/Test/winswTests/winswTests.csproj
+++ b/src/Test/winswTests/winswTests.csproj
@@ -8,8 +8,10 @@
+
+