diff --git a/CHANGELOG.md b/CHANGELOG.md
index 923bcdc..796393c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add `TestsFilePathTooLong` to similate long path inside test.
- Update to use `ricaun.Revit.UI.Tasks` library to run async tests.
- Update `ApplicationUtils` check local file exists.
+- Update `RevitTestConsole` with `SetCurrentDirectory` using the source test file.
## [1.3.4] / 2024-05-27
### Console
diff --git a/Directory.Build.props b/Directory.Build.props
index 4c3e1e8..0a651a1 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,5 +1,5 @@
- 1.3.5-rc.2
+ 1.3.5-rc.3
\ No newline at end of file
diff --git a/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs b/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs
index a0af3cf..9e02539 100644
--- a/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs
+++ b/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs
@@ -147,15 +147,18 @@ public static async Task DownloadAsync(string applicationFolder, string ad
private static bool LocalFileExists(string filePath, out string localFilePath)
{
localFilePath = filePath;
+
+ if (File.Exists(localFilePath)) return true;
+
try
{
- var assemblyDirectory = Path.GetDirectoryName(typeof(ApplicationUtils).Assembly.Location);
- localFilePath = Path.Combine(assemblyDirectory, filePath);
+ var currentDirectory = Directory.GetCurrentDirectory();
+ localFilePath = Path.Combine(currentDirectory, filePath);
localFilePath = new FileInfo(localFilePath).FullName;
AdapterLogger.Logger.Debug($"Application LocalFileCheck: {localFilePath}");
if (File.Exists(localFilePath))
{
- AdapterLogger.Logger.DebugOnlyLocal($"Download File AssemblyDirectory: {assemblyDirectory}");
+ AdapterLogger.Logger.DebugOnlyLocal($"Download LocalFileCheck: {localFilePath}");
return true;
}
}
diff --git a/ricaun.RevitTest.TestAdapter/Services/RevitTestConsole.cs b/ricaun.RevitTest.TestAdapter/Services/RevitTestConsole.cs
index 5e77781..59008d5 100644
--- a/ricaun.RevitTest.TestAdapter/Services/RevitTestConsole.cs
+++ b/ricaun.RevitTest.TestAdapter/Services/RevitTestConsole.cs
@@ -61,8 +61,15 @@ private string ValidadeApplication(string applicationPath, bool showApplicationN
return null;
}
- public RevitTestConsole(string application = null)
+ public RevitTestConsole(string application = null, string sourceFile = null)
{
+ if (!string.IsNullOrEmpty(sourceFile))
+ {
+ var directory = Path.GetDirectoryName(sourceFile);
+ if (Directory.Exists(directory))
+ Directory.SetCurrentDirectory(directory);
+ }
+
applicationPath = ValidadeApplication(application, true);
if (applicationPath is null)
{
diff --git a/ricaun.RevitTest.TestAdapter/TestDiscoverer.cs b/ricaun.RevitTest.TestAdapter/TestDiscoverer.cs
index bcd5c79..2c213cd 100644
--- a/ricaun.RevitTest.TestAdapter/TestDiscoverer.cs
+++ b/ricaun.RevitTest.TestAdapter/TestDiscoverer.cs
@@ -5,6 +5,7 @@
using ricaun.RevitTest.TestAdapter.Services;
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -45,7 +46,8 @@ internal static List GetTests(
{
Metadatas.MetadataSettings.Create(source);
AdapterLogger.Logger.Info($"DiscoverTests: {source}");
- using (var revit = new RevitTestConsole(AdapterSettings.Settings.NUnit.Application))
+
+ using (var revit = new RevitTestConsole(AdapterSettings.Settings.NUnit.Application, source))
{
if (revit.IsTrusted(out string message) == false)
{
diff --git a/ricaun.RevitTest.TestAdapter/TestExecutor.cs b/ricaun.RevitTest.TestAdapter/TestExecutor.cs
index 44ee769..526371c 100644
--- a/ricaun.RevitTest.TestAdapter/TestExecutor.cs
+++ b/ricaun.RevitTest.TestAdapter/TestExecutor.cs
@@ -90,7 +90,7 @@ private async Task RunTests(IFrameworkHandle frameworkHandle, string source, Lis
AdapterLogger.Logger.Info($"RevitTestConsole: {AdapterSettings.Settings.NUnit.Application}");
AdapterLogger.Logger.Info("---------");
- using (var revit = new RevitTestConsole(AdapterSettings.Settings.NUnit.Application))
+ using (var revit = new RevitTestConsole(AdapterSettings.Settings.NUnit.Application, source))
{
if (revit.IsTrusted(out string message) == false)
{